cva.glmnet: Cross-validation of alpha for glmnet

View source: R/cva.glmnet.R

cva.glmnetR Documentation

Cross-validation of alpha for glmnet

Description

Performs k-fold cross-validation for glmnet, including alpha mixing parameter.

Usage

cva.glmnet(x, y, nfolds = 10, alphaSet = seq(0.1, 1, 0.1), foldid = NULL, ...)

Arguments

x

Matrix of predictors

y

Response vector

nfolds

Number of folds (default 10)

alphaSet

Sequence of alpha values to cross-validate

foldid

Optional vector of values between 1 and nfolds identifying what fold each observation is in.

...

Other arguments passed to cv.glmnet

Value

Object of S3 class "cva.glmnet", which is a list of the cv.glmnet objects for each value of alpha and alphaSet.

fits

List of fitted cv.glmnet objects

alphaSet

Sequence of alpha values used

alpha_cvm

The mean cross-validated error - a vector of length length(alphaSet).

best_alpha

Value of alpha giving lowest alpha_cvm.

which_alpha

Index of alphaSet with lowest alpha_cvm

Author(s)

Myles Lewis

See Also

cv.glmnet, glmnet


nestedcv documentation built on Oct. 26, 2023, 5:08 p.m.