View source: R/dCVnet_utilities.R
cv_performance_glm | R Documentation |
Cross-validated estimates of model performance by repeated k-fold cross-validation.
cv_performance_glm(
y,
data,
f = "~.",
folds = NULL,
k = 10,
nrep = 2,
family = "binomial",
opt.ystratify = TRUE,
opt.uniquefolds = FALSE,
return_summary = TRUE,
offset = NULL,
...
)
y |
outcome vector (numeric or factor) |
data |
predictors in a data.frame |
f |
a formula to apply to x |
folds |
This is a list where each element is an integer vector of length n_cases. The integer for each case labels it as belonging to a fold 1:n_folds. This argument overrides the number of repeats and the k in repeated k-fold cv. |
k |
the number of folds for k-fold cross-validation. |
nrep |
the number of repetitions |
family |
Either a character string representing
one of the built-in families, or else a |
opt.ystratify |
Boolean.
Outer and inner sampling is stratified by outcome.
This is implemented with |
opt.uniquefolds |
Boolean. In most circumstances folds will be unique. This requests that random folds are checked for uniqueness in inner and outer loops. Currently it warns if non-unique values are found. |
return_summary |
bool. return summarised performance (default), or
|
offset |
optional model offset (see |
... |
other arguments |
This function is nothing revolutionary. The idea is to
extend boot{cv.glm}
with an interface that better matches
the other functions in this package.
The additions are:
Repeated k-fold rather than single k-fold
Option to provide the fold membership
Default use of stratified sampling by outcome class
Performance assessed with summary.performance
A list containing the following:
glm.performance - summary(performance(x)) for the uncrossvalidated model
cv.performance - report_performance_summary(cv.fits) for the crossvalidated model
folds - the folds used in cross-validation
call - the function call
cv.glm
, performance
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.