nested.glm | R Documentation |
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.
nested.glm(formula, data, family, folds, store.glm = FALSE)
formula |
An object of class |
data |
Data frame or matrix containing outcome variable and predictors. |
family |
Type of model fitted: either |
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 |
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 |
nested.performance()
.
data(diabetes) folds <- create.folds(10, nrow(diabetes), seed=1) res <- nested.glm(Y ~ age + sex + bmi + map, diabetes, gaussian(), folds)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.