nested.glm: Cross-validated generalized linear models
Description
Run linear or logistic regression on a set of cross-validation folds.
This can be used to establish a baseline model, often built only on the
initial set of covariates.
An object of class nestglm of length equal to length(folds),
where each entry contains the following fields:
summary
Summary of the coefficients of the model fitted on the
training observations.
family
Type of model fitted.
fit
Predicted values for the withdrawn observations.
obs
Observed values for the withdrawn observations.
test.llk
Test log-likelihood.
test.idx
Indices of the the withdrawn observations for this fold.
regr
Object created by glm (only if store.glm=TRUE).
Arguments
formula
An object of class formula (or one that can be coerced to
that class) that describes the baseline model to be fitted.
data
Data frame or matrix containing outcome variable and predictors.
family
Type of model fitted: either gaussian() for linear regression
or binomial() for logistic regression. This can be specified also as
a function name (gaussian) or as a string ("gaussian").
folds
List of cross-validation folds, where each element contains
the indices of the observations to be withdrawn in that fold.
store.glm
Whether the object produced by glm should be
stored (default: FALSE).