cv.sparsenet: Cross-validation for weighted sparsenet

Description Usage Arguments Value Author(s) See Also Examples

Description

Performs k-fold cross validation for MCP penalized regression models over a grid of values for parameter λ and κ.

Usage

1
cv.sparsenet(result, X, y, delta, n_lambda = 100, n_kappa = 1, kappa0 = 1/3, lambda0 = -1, eps = 1e-06, max.iter = 100, method = "include", power = 2, fold = 5, weight = NA, AFT = TRUE, penalty = "MCP", stratified = TRUE)

Arguments

result

a list consists of result from weighted.sparsenet.

X

Design matrix of size \eqn{n} by \eqn{p}, where \eqn{n} is the sample size and \eqn{p} is the number of variables. This is the original design matrix.

y

Response vector of length n. This is the original response variable.

delta

Indicator vector of length n. Useful when AFT is TRUE. If δ_i equals 1, y_i is log failure time. If δ_i equals 0, y_i is log censoring time.

n_lambda

number of lambda values in the grid. Default value is 100.

n_kappa

number of kappa values in the grid. Default value is 1.

kappa0

Maximum value of κ. Default value is 1/3.

lambda0

Maximum value of λ. Default value is -1. If lambda0 = -1, by default the maximum value of λ will be the minimum λ such that all estimates of β are zero.

eps

Convergence threshhold. The algorithm iterates until the relative change in any coefficient is less than eps. Default is 1e-6.

max.iter

Maximum number of iteration. Default is 100.

method

Character. Either "exclude" or "include". If method equals "exclude", after the LASSO step, the function will automatically exclude all the zero estimates from LASSO and pass only the variables associated with non-zero estimates to MCP step. If method equals "include", then LASSO estimates will serve as a warm start value and all variables will be included in the MCP step.

power

Specifies the power of the loss function in cross validation. Default is 2.

fold

Number of folds in cross validation. Default is 5.

weight

Only useful when AFT is FALSE. Specifies the user defined weights associated with observations. Default is NA.

AFT

Logical. If TRUE, the function uses the accelerated failure time model to fit the response variable and weight will be calculated as Kaplan-Meier weights. If FALSE, weight will be the user specified weights for each observation. Default is TRUE.

penalty

The penalty to be added to the objective function. Values could be "MCP" (the default), "SCAD" or "adaptive" for MCP, SCAD and adaptive LASSO penalties, respectively. LASSO result is automatically computed.

stratified

Logical. This indicates whether stratified sampling should be used in the cross-validation. If TRUE, stratified sampling is used. If FALSE, simple sampling method is used. Default value is TRUE.

Value

A list of results.

betalasso

The fitted vector of coefficients with LASSO penalty. The length is equal to the number of coefficients in the model.

betamcp

The fitted vector of coefficients with MCP penalty. The length is equal to the number of coefficients in the model.

betascad

The fitted vector of coefficients with SCAD penalty. The length is equal to the number of coefficients in the model.

lasso.lambda

The best lambda value chosen by BIC criteria when LASSO is used as the penalty function.

mcp.lambda

The best lambda value chosen by BIC criteria when MCP is used as the penalty function.

mcp.kappa

The best kappa value chosen by BIC criteria when MCP is used as the penalty function.

scad.lambda

The best lambda value chosen by BIC criteria when SCAD is used as the penalty function.

scad.kappa

The best kappa value chosen by BIC criteria when SCAD is used as the penalty function.

name.lasso

The names associated with the selected variables by LASSO penalty.

name.mcp

The names associated with the selected variables by MCP penalty.

Author(s)

Hao Chai <hao.chai@yale.edu>

See Also

bic.sparsenet

Examples

1
2
3
4
5
6
X = matrix(rnorm(8000), nrow = 20)
beta0 = c(rep(10, 5), rep(0, 395))
y = rnorm(20) + X %*% beta0
delta = rep(1, 20)
result = weighted.sparsenet(X, y, delta, n_kappa = 40, kappa0 = 0.99)
cv.sparsenet(result, X, y, delta, n_kappa = 40, kappa0 = 0.99)

andrewchay/aft-hd documentation built on May 14, 2019, 8:21 a.m.