hdcox.scad: SCAD Model Selection for High-Dimensional Cox Models

Description Usage Arguments Examples

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

Description

Automatic SCAD model selection for high-dimensional Cox models, evaluated by penalized partial-likelihood.

Usage

1
2
3
hdcox.scad(x, y, nfolds = 5L, gammas = c(2.01, 2.3, 3.7, 200),
  eps = 1e-04, max.iter = 10000L, seed = 1001, trace = FALSE,
  parallel = FALSE)

Arguments

x

Data matrix.

y

Response matrix made by Surv.

nfolds

Fold numbers of cross-validation.

gammas

Gammas to tune in cv.ncvsurv.

eps

Convergence threshhold.

max.iter

Maximum number of iterations.

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.

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 SCAD penalty
fit = hdcox.scad(
  x, y, nfolds = 3, gammas = c(3.7, 5),
  max.iter = 15000, seed = 1010)

# 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$scad_model, model.type = "scad",
  x, time, event, x.df, pred.at = 365 * 2,
  funlabel = "2-Year Overall Survival Probability")

plot(nom)

road2stat/hdnom documentation built on July 2, 2018, 9:33 a.m.