Description Usage Arguments Details Value Author(s) Examples
View source: R/anchor.predictions.R
Generate Predictions for a Model
1 | anchor.predictions(model, reference, shutup = F)
|
model |
The fitted model object to generate predictions |
reference |
A vector (or single value) containing the name of the variable(s) the user wishes to generate predictions for. For categorical variables, the function will generate predictions for every level of the categorical variable. For numeric variables, the function will generate predictions at +1 and -1 standard deviations away from the mean. |
shutup |
The function will give a notice if you don't specify predictions for variables that are in the model. This argument tell it to shut up. |
This function is simply an easy-to-use wrapper for the predict function. With some models (e.g., logistic regression), the metrics are not very intuitive. The anchor.predictions model generates the actual predicted values, depending on what the user specifies.
A data frame containing the predicted values (along with the values of the predictor variables used to estimate the prediction)
Dustin Fife
1 2 3 4 5 6 7 8 9 10 11 | data(exercise_data)
linear.model = lm(weight.loss~health + gender, data=d)
# generate predictions for males/females
anchor.predictions(linear.model, "gender")
# generate predictions for health (+/- 1 sd from the mean)
anchor.predictions(linear.model, "health")
# fit a logistic regression model
data(tablesaw.injury)
glm.mod = glm(injury~safety + attention + gender, data= tablesaw.injury, family=binomial)
anchor.predictions(glm.mod, "attention")
anchor.predictions(glm.mod, c("safety", "gender"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.