cv.higlasso: Cross Validated Hierarchical Integrative Group LASSO

Description Usage Arguments Details Value Author(s) References Examples

View source: R/cv.higlasso.R

Description

Does k-fold cross-validation for higlasso, and returns optimal values for lambda1 and lambda2.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
cv.higlasso(
  Y,
  X,
  Z,
  method = c("aenet", "gglasso"),
  lambda1 = NULL,
  lambda2 = NULL,
  nlambda1 = 10,
  nlambda2 = 10,
  lambda.min.ratio = 0.05,
  nfolds = 10,
  foldid = NULL,
  sigma = 1,
  degree = 3,
  maxit = 5000,
  tol = 1e-05
)

Arguments

Y

A length n numeric response vector

X

A n x p numeric matrix

Z

A n x m numeric matrix

method

Type of initialization to use. Possible choices are gglasso for group LASSO and aenet for adaptive elastic net. Default is aenet

lambda1

A numeric vector of main effect penalties on which to tune By default, lambda1 = NULL and higlasso generates a length nlambda1 sequence of lambda1s based off of the data and min.lambda.ratio

lambda2

A numeric vector of interaction effects penalties on which to tune. By default, lambda2 = NULL and generates a sequence (length nlambda2) of lambda2s based off of the data and min.lambda.ratio

nlambda1

The number of lambda1 values to generate. Default is 10, minimum is 2. If lambda1 != NULL, this parameter is ignored

nlambda2

The number of lambda2 values to generate. Default is 10, minimum is 2. If lambda2 != NULL, this parameter is ignored

lambda.min.ratio

Ratio that calculates min lambda from max lambda. Ignored if 'lambda1' or 'lambda2' is non NULL. Default is 0.05

nfolds

Number of folds for cross validation. Default is 10. The minimum is 3, and while the maximum is the number of observations (ie leave one out cross validation)

foldid

An optional vector of values between 1 and max(foldid) identifying what fold each observation is in. Default is NULL and cv.higlasso will automatically generate foldid based off of nfolds

sigma

Scale parameter for integrative weights. Technically a third tuning parameter but defaults to 1 for computational tractability

degree

Degree of bs basis expansion. Default is 3

maxit

Maximum number of iterations. Default is 5000

tol

Tolerance for convergence. Defaults to 1e-5

Details

There are a few things to keep in mind when using cv.higlasso

As a side effect of the conservativeness of the method, we have found that using the 1 standard error rule results in overly sparse models, and that lambda.min generally performs better.

Value

An object of type cv.higlasso with 7 elements

lambda

An nlambda1 x nlambda2 x 2 array containing each pair (lambda1, lambda2) pair.

lambda.min

lambda pair with the lowest cross validation error

lambda.1se
cvm

cross validation error at each lambda pair. The error is calculated from the mean square error.

cvse

standard error of cvm at each lambda pair.

higlasso.fit

higlasso output from fitting the whole data.

call

The call that generated the output.

Author(s)

Alexander Rix

References

TODO

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(higlasso)

X <- as.matrix(higlasso.df[, paste0("V", 1:10)])
Y <- higlasso.df$Y
Z <- matrix(1, nrow(X))

## Not run: 
# This can take a bit of time
cv.fit <- cv.higlasso(Y, X, Z)

## End(Not run)

umich-cphds/higlasso documentation built on Feb. 14, 2020, 8:23 a.m.