hdcox.flasso: Fused Lasso Model Selection for High-Dimensional Cox Models

Description Usage Arguments Note Examples

View source: R/01-hdnom-models.R

Description

Automatic fused lasso model selection for high-dimensional Cox models, evaluated by cross-validated likelihood.

Usage

1
2
3
hdcox.flasso(x, y, nfolds = 5L, lambda1 = c(0.001, 0.05, 0.5, 1, 5),
  lambda2 = c(0.001, 0.01, 0.5), maxiter = 25, epsilon = 0.001,
  seed = 1001, trace = FALSE, parallel = FALSE, ...)

Arguments

x

Data matrix.

y

Response matrix made by Surv.

nfolds

Fold numbers of cross-validation.

lambda1

Vector of lambda1 candidates. Default is 0.001, 0.05, 0.5, 1, 5.

lambda2

Vector of lambda2 candidates. Default is 0.001, 0.01, 0.5.

maxiter

The maximum number of iterations allowed. Default is 25.

epsilon

The convergence criterion. Default is 1e-3.

seed

A random seed for cross-validation fold division.

trace

Output the cross-validation parameter tuning progress or not. Default is FALSE.

parallel

Logical. Enable parallel parameter tuning or not, default is FALSE. To enable parallel tuning, load the doParallel package and run registerDoParallel() with the number of CPU cores before calling this function.

...

other parameters to cvl and penalized.

Note

The cross-validation procedure used in this function is the approximated cross-validation provided by the penalized package. Be careful dealing with the results since they might be more optimistic than a traditional CV procedure. This cross-validation method is more suitable for datasets with larger number of observations, and a higher number of cross-validation folds.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library("survival")
library("rms")

# Load imputed SMART data; only use the first 120 samples
data("smart")
x = as.matrix(smart[, -c(1, 2)])[1:120, ]
time = smart$TEVENT[1:120]
event = smart$EVENT[1:120]
y = Surv(time, event)

# Fit Cox model with fused lasso penalty
fit = hdcox.flasso(x, y,
  lambda1 = c(1, 10), lambda2 = c(0.01),
  nfolds = 3, seed = 11)

# Prepare data for hdnom.nomogram
x.df = as.data.frame(x)
dd = datadist(x.df)
options(datadist = "dd")

# Generate hdnom.nomogram objects and plot nomogram
nom = hdnom.nomogram(
  fit$flasso_model, model.type = "flasso",
  x, time, event, x.df, pred.at = 365 * 2,
  funlabel = "2-Year Overall Survival Probability")

plot(nom)

hdnom documentation built on Sept. 29, 2017, 9:03 a.m.