Accuracy of predictions from model fitSource:
This function calculates the predictive accuracy of linear or logistic regression models.
performance_accuracy( model, method = c("cv", "boot"), k = 5, n = 1000, ci = 0.95, verbose = TRUE )
A linear or logistic regression model. A mixed-effects model is also accepted.
Character string, indicating whether cross-validation (
method = "cv") or bootstrapping (
method = "boot") is used to compute the accuracy values.
The number of folds for the k-fold cross-validation.
Number of bootstrap-samples.
The level of the confidence interval.
A list with three values: The
Accuracy of the model
predictions, i.e. the proportion of accurately predicted values from the
model, its standard error,
SE, and the
Method used to compute
For linear models, the accuracy is the correlation coefficient
between the actual and the predicted value of the outcome. For
logistic regression models, the accuracy corresponds to the
AUC-value, calculated with the
The accuracy is the mean value of multiple correlation resp. AUC-values, which are either computed with cross-validation or non-parametric bootstrapping (see argument
The standard error is the standard deviation of the computed
correlation resp. AUC-values.
model <- lm(mpg ~ wt + cyl, data = mtcars) performance_accuracy(model) #> # Accuracy of Model Predictions #> #> Accuracy (95% CI): 89.97% [85.01%, 94.24%] #> Method: Correlation between observed and predicted model <- glm(vs ~ wt + mpg, data = mtcars, family = "binomial") performance_accuracy(model) #> # Accuracy of Model Predictions #> #> Accuracy (95% CI): 92.50% [76.25%, 100.00%] #> Method: Area under Curve