Kaplan-Meier Plot with Number at Risk Table for Internal Calibration and External Calibration Results

Description

Kaplan-Meier Plot with Number at Risk Table for Internal Calibration and External Calibration Results

Usage

1
2
hdnom.kmplot(object, group.name = NULL, time.at = NULL, col.pal = c("JCO",
  "Lancet", "NPG", "AAAS"))

Arguments

object

An object returned by hdnom.calibrate or hdnom.external.calibrate.

group.name

Risk group labels. Default is Group 1, Group 2, ..., Group k.

time.at

Time points to evaluate the number at risk.

col.pal

Color palette to use. Possible values are "JCO", "Lancet", "NPG", and "AAAS". Default is "JCO".

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
28
29
30
31
32
33
34
35
36
37
library("survival")

# Load imputed SMART data
data("smart")

# Use the first 1000 samples as training data
# (the data used for internal validation)
x = as.matrix(smart[, -c(1, 2)])[1:1000, ]
time = smart$TEVENT[1:1000]
event = smart$EVENT[1:1000]

# Take the next 1000 samples as external calibration data
# In practice, usually use data collected in other studies
x_new = as.matrix(smart[, -c(1, 2)])[1001:2000, ]
time_new = smart$TEVENT[1001:2000]
event_new = smart$EVENT[1001:2000]

# Fit Cox model by lasso penalization
lassofit = hdcox.lasso(x, Surv(time, event), nfolds = 5, rule = "lambda.1se", seed = 11)

### Internal calibration
cal.int = hdnom.calibrate(x, time, event, model.type = "lasso",
                          alpha = 1, lambda = lassofit$'lasso_best_lambda',
                          method = "cv", nfolds = 5,
                          pred.at = 365 * 9, ngroup = 3)

hdnom.kmplot(cal.int, group.name = c('High risk', 'Medium risk', 'Low risk'),
             time.at = 1:6 * 365)

### External calibration
cal.ext =
  hdnom.external.calibrate(lassofit, x, time, event,
                           x_new, time_new, event_new,
                           pred.at = 365 * 5, ngroup = 3)

hdnom.kmplot(cal.ext, group.name = c('High risk','Medium risk', 'Low risk'),
             time.at = 1:6 * 365)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.