tidypredict_sql_interval
Returns a SQL query with formula to calculate predicted interval
tidypredict_sql_interval(model, con, interval = 0.95)
Arguments
model | An R model or a tibble with a parsed model |
con | Database connection object. It is used to select the correct SQL translation syntax. |
interval | The prediction interval, defaults to 0.95 |
Examples
library(dbplyr)
model <- lm(mpg ~ wt + am + cyl, data = mtcars)
tidypredict_sql_interval(model, simulate_dbi())#> <SQL> (2.04840714179524) * SQRT((((((-0.176776695296637) * (-0.176776695296637) * (6.8231093058295)) + (((-0.590557271637747) + (("wt") * (0.183559646169165))) * ((-0.590557271637747) + (("wt") * (0.183559646169165))) * (6.8231093058295))) + ((((0.769566489443368) + (("wt") * (-0.176199380745393))) + (("am") * (-0.498926847360626))) * (((0.769566489443368) + (("wt") * (-0.176199380745393))) + (("am") * (-0.498926847360626))) * (6.8231093058295))) + (((((-0.224404416240186) + (("wt") * (-0.23845787029348))) + (("am") * (-0.0214203331902853))) + (("cyl") * (0.161662223806132))) * ((((-0.224404416240186) + (("wt") * (-0.23845787029348))) + (("am") * (-0.0214203331902853))) + (("cyl") * (0.161662223806132))) * (6.8231093058295))) + (6.8231093058295))