performance_cv {performance} | R Documentation |
Cross-validated model performance
Description
This function cross-validates regression models in a user-supplied new sample or by using holdout (train-test), k-fold, or leave-one-out cross-validation.
Usage
performance_cv(
model,
data = NULL,
method = c("holdout", "k_fold", "loo"),
metrics = "all",
prop = 0.3,
k = 5,
stack = TRUE,
verbose = TRUE,
...
)
Arguments
model |
A regression model. |
data |
Optional. A data frame containing the same variables as |
method |
Character string, indicating the cross-validation method to use:
whether holdout ( |
metrics |
Can be |
prop |
If |
k |
If |
stack |
Logical. If |
verbose |
Toggle warnings. |
... |
Not used. |
Value
A data frame with columns for each metric requested, as well as k
if method = "holdout"
and the Method
used for cross-validation. If
method = "holdout"
and stack = TRUE
, the standard error (standard
deviation across holdout folds) for each metric is also included.
Examples
model <- lm(mpg ~ wt + cyl, data = mtcars)
performance_cv(model)