cv_glasso: Cross-validation for group lasso logistic regression

Description Usage Arguments Value Author(s) Examples

Description

Does k-fold cross-validation for group lasso logistic regression and returns a list object

Usage

1
2
cv_glasso(trainx, trainy, nlam = 100, type = "link", kfold = 10,
  na_action = na.pass)

Arguments

trainx

a data frame where samples are in rows and features are in columns

trainy

a numeric or factor vector containing the outcome for each sample

nlam

number of lambda values. The default is 100

type

the type of prediction. type = 'link' is on the scale of linear predictors (default), whereas type = 'response' is on the scale of the response variable, i.e. type = 'response' applies the inverse link function to the linear predictors.

kfold

number of folds - default is 10. Although nfolds can be as large as the sample size (leave-one-out CV), it is not recommended for large datasets. The default is 10.

na_action

function determining what should be done with missing values when predicting new data during cross validation. The default is to predict NA.

Value

an object of class "cv_glasso" is returned, which is a list with the ingredients of the cross-validation fit.

Author(s)

Hui Lin, longqiman@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
data("sim1_da1")
trainx = dplyr::select(sim1_da1, -y)
trainy = sim1_da1$y
# index of the group
index <- gsub("\\..*", "", names(trainx))
# nlam is the number of values of tuning variable
nlam <- 10
# type of prediction
type = "link"
# number of cross-validation folds
kfold <- 10
cv_fit <- cv_glasso(trainx, trainy, nlam = nlam, kfold = kfold)
str(cv_fit)

## End(Not run)

happyrabbit/DataScienceR documentation built on May 17, 2019, 2:41 p.m.