a3.r2: Cross-Validated $R^2$
Description
Applies cross validation to obtain the cross-validated
$R^2$ for a model: the fraction of the squared error
explained by the model compared to the null model (which
is defined as the average response). A pseudo $R^2$
is implemented for classification.Usage
a3.r2(y, x, simulate.fn, cv.folds)
Arguments
simulate.fn
a function object that creates a model
and predicts y.
cv.folds
the cross-validation folds.
Value
- A list comprising of the following elements:
- R2the cross-validated $R^2$
- predictedthe predicted responses
- observedthe observed responses