hdnom.nomogram: Nomograms for High-Dimensional Cox Models

Description Usage Arguments Note Examples

View source: R/02-hdnom-nomogram.R

Description

Nomograms for High-Dimensional Cox Models

Usage

1
2
3
hdnom.nomogram(object, model.type = c("lasso", "alasso", "flasso", "enet",
  "aenet", "mcp", "mnet", "scad", "snet"), x, time, event, ddist,
  pred.at = NULL, fun.at = NULL, funlabel = NULL)

Arguments

object

Fitted model object.

model.type

Fitted model type. Could be one of "lasso", "alasso", "flasso", "enet", "aenet", "mcp", "mnet", "scad", or "snet".

x

Matrix of training data used for fitting the model.

time

Survival time. Must be of the same length with the number of rows as x.

event

Status indicator, normally 0 = alive, 1 = dead. Must be of the same length with the number of rows as x.

ddist

Data frame version of x, made by datadist.

pred.at

Time point at which to plot nomogram prediction axis.

fun.at

Function values to label on axis.

funlabel

Label for fun axis.

Note

We will try to use the value of the selected penalty parameter (e.g. lambda, alpha) in the model object fitted by glmnet, ncvsurv, or penalized. The selected variables under the penalty parameter will be used to build the nomogram and make predictions. This means, if you use routines other than hdcox.* functions to fit the model, please make sure that there is only one set of necessary parameters (e.g. only a single lambda should be in glmnet objects intead of a vector of multiple lambdas) in the fitted model object.

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
library("rms")

# Load imputed SMART data
data(smart)
x = as.matrix(smart[, -c(1, 2)])
time = smart$TEVENT
event = smart$EVENT
y = Surv(time, event)

# Fit penalized Cox model with lasso penalty
fit = hdcox.lasso(x, y, nfolds = 5, rule = "lambda.1se", seed = 11)

# Prepare data needed for plotting 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$lasso_model, model.type = "lasso",
  x, time, event, x.df, pred.at = 365 * 2,
  funlabel = "2-Year Overall Survival Probability")

print(nom)
plot(nom)

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