cox_blasso: Bootstrap Validation for Cox Lasso Regression

View source: R/cox_blasso.R

cox_blassoR Documentation

Bootstrap Validation for Cox Lasso Regression

Description

This function performs n glmnet::cv.glmnet(family = "cox") models using bootstrap validation and splitting the input data in train and test at each loop.

Usage

cox_blasso(
  x,
  y,
  loops = 2,
  bootstrap = TRUE,
  alpha = 1,
  nfolds = 10,
  seed = 987654321,
  ncores = 2
)

Arguments

x

x matrix as in glmnet.

y

Should be a two-column matrix with columns named 'time' and 'status'. The latter is a binary variable, with '1' indicating death, and '0' indicating right censored.

loops

Number of loops (a glmnet::cv.glmnet model will be performed in each loop).

bootstrap

Logical indicating if bootstrap will be performed or not.

alpha

The elasticnet mixing parameter, with 0 ≤ alpha ≤ 1. alpha = 1 is the lasso penalty, and alpha = 0 the ridge penalty.

nfolds

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. Smallest value allowable is nfolds=3.

seed

set.seed() that will be used.

ncores

Number of cores. Each loop will run in one core using the foreach package.

Value

A LassoLoop object with the results.

Author(s)

Pol Castellano-Escuder

References

Jerome Friedman, Trevor Hastie, Robert Tibshirani (2010). Regularization Paths for Generalized Linear Models via Coordinate Descent. Journal of Statistical Software, 33(1), 1-22. URL http://www.jstatsoft.org/v33/i01/.


pcastellanoescuder/lassoloops documentation built on July 25, 2022, 12:42 p.m.