cv.grpCox: Cross-validation for grpCox

Description Usage Arguments Value Author(s) References Examples

View source: R/grpCox.R

Description

Does k-fold cross-validation for grpCox

Usage

1
2
3
cv.grpCox(X, y, g, m, penalty=c("glasso", "gSCAD", "gMCP"), lambda=NULL, 
nlambda=100, rlambda=NULL, gamma=switch(penalty, SCAD = 3.7, 3), 
standardize=TRUE, thresh=1e-3, maxit=1e+4, nfolds=10, foldid=NULL)

Arguments

X

The design matrix.

y

The response vector includes time corresponding to failure/censor times, and status indicating failure (1) or censoring (0).

g

A vector indicating the group structure of the covariates. It can be unordered groups.

m

Group multipliers. Default is the square root of group size.

penalty

The penalty to be applied to the model. It is one of glasso, gSCAD, or gMCP.

lambda

A user supplied sequence of lambda values. If it is left unspecified, and the function automatically computes a grid of lambda values.

nlambda

The number of lambda values to use in the regularization path. Default is 100.

rlambda

Smallest value for lambda, as a fraction of the maximum lambda, the (data derived) entry value (i.e. the smallest value for which all coefficients are zero). The default depends on the sample size relative to the number of covariates. If sample size>#covariates, the default is 0.001, close to zero. If sample size>#covariates, the default is 0.05.

gamma

Tuning parameter of the group SCAD/MCP penalty. Default is 3.7 for SCAD and 3 for MCP.

standardize

Logical flag for variable standardization prior to fitting the model.

thresh

Convergence threshold for one-step coordinate descent. Defaults value is 1E-7.

maxit

Maximum number of passes over the data for all lambda values; default is 1E+5.

nfolds

The number of cross-validation folds. Default is 10.

foldid

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

Value

aBetaSTD

A standardized coefficient matrix whose columns correspond to nlambda values of lambda.

aBetaO

A coefficient matrix (without standardization) whose columns correspond to nlambda values of lambda.

mBetaSTD

The coefficient in standardized form gives maximum log-likelihood value using the first cross-validation method.

mBetaO

The coefficient in original form gives maximum log-likelihood value using the first cross-validation method.

pBetaSTD

The coefficient in standardized form gives maximum log-likelihood value using the penalized cross-validation method.

pBetaO

The coefficient in original formgives maximum log-likelihood value using the penalized cross-validation method.

fit

A matrix includes lambda value, the mean cross-validation error.

lambda

The lambda values used.

g

A vector indicating the group structure of the covariates.

cvmax

The maximum value of log likelihood.

lambda.max

The value of lambda corresponds to the maximum value of log likelihood using the first cross-validation method.

lambda.pcvl

The value of lambda corresponds to the maximum value of log likelihood using the penalized cross-validation method.

Author(s)

Xuan Dang <xuandang11289@gmail.com>

References

Verweij PJ, Houwelingen HC. Cross-validation in survival analysis. Statistics in Medicine 1993; 12(24): 385-395.

Ternes N, Rotolo F, Michiels S. Empirical extensions of the lasso penalty to reduce the false discovery rate in highdimensional Cox regression models. Statistics in Medicine 2016; 35(15): 2561-73.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
set.seed(200)
N <- 50
p <- 9
x <- matrix(rnorm(N * p), nrow = N)
beta <- c(.65,.65,0,0,.65,.65,0,.65,0)
hx <- exp(x %*% beta) 
ty <- rexp(N,hx) 
tcens <- 1 - rbinom(n=N, prob = 0.2, size = 1)
y <- data.frame(illt=ty, ills=tcens)
names(y) <- c("time", "status")

g <- c(1,1,2,2,3,3,2,3,2)
m <- c(sqrt(2),sqrt(4),sqrt(3))

cvfit <- cv.grpCox(x,y,g,m,penalty="glasso")
plot.llCV(cvfit)
plot.gCoef(cvfit$aBetaO, cvfit$g, cvfit$lambda)

grpCox documentation built on Sept. 16, 2020, 9:07 a.m.