Description Usage Arguments Details Examples
Safe predictions from a linear model
1 2 3 | ## S3 method for class 'lm'
safe_predict(object, new_data, type = c("response",
"conf_int", "pred_int"), ..., std_error = FALSE, level = 0.95)
|
object |
An |
new_data |
TODO |
type |
What kind of predictions to return. Options are:
|
... |
Unused. |
std_error |
Logical indicating whether or not calculate standard
errors for the fit at each point. Not available for all models, and can
be computationally expensive to compute. The standard error is always
the standard error for the mean, and never the standard error for
predictions. Standard errors are returned in a column called |
level |
A number strictly between |
Do not use on model objects that only subclass lm
. This will result
in an error.
1 2 3 4 5 6 7 8 9 | fit <- lm(hp ~ ., mtcars)
safe_predict(fit, mtcars)
mt2 <- mtcars
diag(mt2) <- NA
safe_predict(fit, mt2, std_error = TRUE)
safe_predict(fit, mt2, type = "pred_int", level = 0.9)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.