It parses a model or uses an already parsed model to return a Tidy Eval formula that can then be used inside a dplyr command.

tidypredict_interval(model, interval = 0.95)

Arguments

model

An R model or a list with a parsed model

interval

The prediction interval, defaults to 0.95

Details

The result still has to be added to the fit to obtain the upper bound, and subtracted from fit to obtain the lower bound.

Examples

model <- lm(mpg ~ wt + cyl * disp, offset = am, data = mtcars) tidypredict_interval(model)
#> 2.05183051648029 * sqrt(-0.176776695296637 * -0.176776695296637 * #> 6.20704821338125 + (-0.590557271637747 + wt * 0.183559646169165) * #> (-0.590557271637747 + wt * 0.183559646169165) * 6.20704821338125 + #> (-0.257207134290773 + wt * -0.230680634727453 + cyl * 0.161513439412957) * #> (-0.257207134290773 + wt * -0.230680634727453 + cyl * #> 0.161513439412957) * 6.20704821338125 + (-0.868335233010594 + #> wt * 0.271667738147758 + cyl * 0.169308509351746 + disp * #> -0.0045651683402764) * (-0.868335233010594 + wt * 0.271667738147758 + #> cyl * 0.169308509351746 + disp * -0.0045651683402764) * 6.20704821338125 + #> (-1.53184887490413 + wt * -0.163034819828352 + cyl * 0.221405540626369 + #> disp * 0.0170837100474746 + cyl * disp * -0.0020081028047214) * #> (-1.53184887490413 + wt * -0.163034819828352 + cyl * #> 0.221405540626369 + disp * 0.0170837100474746 + cyl * #> disp * -0.0020081028047214) * 6.20704821338125 + #> 6.20704821338125)