Adds predictions (and optionally confidence intervals) from one or more
glm models to a data frame.
Usage
add_prediction(
data,
...,
predictions = NULL,
prefix = "pred",
confidence = FALSE,
interval_names = c("lower", "upper"),
alpha = 0.1,
var = NULL,
conf_int = NULL
)Arguments
- data
A
data.framecontaining the new data for which predictions should be generated.- ...
One or more fitted model objects of class
"glm".- predictions
Optional character vector giving names for the new prediction columns. Must have the same length as the number of models supplied. If
NULL(default), names are generated automatically usingprefix, the model response, and the model object name.- prefix
Character. Prefix used for automatically generated prediction column names. Default is
"pred".- confidence
Logical. If
TRUE, add confidence intervals for predictions. Default isFALSE.- interval_names
Character vector of length two. Names appended to the prediction column name for lower and upper confidence interval bounds. Default is
c("lower", "upper").- alpha
Numeric between 0 and 1. Controls the miscoverage level for interval estimates. Default is
0.10, corresponding to a 90% confidence interval.- var
Deprecated. Use
predictionsinstead.- conf_int
Deprecated. Use
confidenceinstead.
