Description Usage Arguments Details Value Examples
A wrapper function that implements K-fold cross validation for a chosen algorithm with binary data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | kfold_cv(y, X, type, K = 10, control = list(), progress = T)
is.kfold_cv(x)
## S3 method for class 'kfold_cv'
levels(x)
## S3 method for class 'kfold_cv'
dimnames(x)
## S3 method for class 'kfold_cv'
max(x, train = F, metric = "AUC", na.rm = FALSE)
## S3 method for class 'kfold_cv'
features(x, metric = "AUC")
## S3 method for class 'kfold_cv'
coef(x, int = F, sig = T, metric = "AUC")
## S3 method for class 'kfold_cv'
print(x, digits = 2, metric = "AUC")
## S3 method for class 'kfold_cv'
summary(x, metric = "AUC")
|
y |
A factor with two levels. |
X |
A matrix of predictors with the number of rows equal
to the length of |
type |
The type of fitting algorithm to use. Options
include |
K |
The number of folds to use. |
control |
An optional list of estimation parameters for the chosen algorithm. |
progress |
Logical; If |
The method max
can be used to extract the
label for the fold that produced the best value for
a specified metric with the test sample. The method
features
extracts the labels for the independent
variables associated with the best-performing fold.
The method summary
reports the coefficients
and denotes which were statistically significant
across all folds.
An R object of class 'kfold_cv'.
1 2 3 4 5 | # Simulate data
sim = bc_simulate( 500, 8, 4 )
# Conduct 10-fold CV
cv_glm = kfold_cv( sim$y, sim$X, type = 'glm' )
cv_glmnet = kfold_cv( sim$y, sim$X, type = 'glmnet' )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.