Skip to contents

Construct nomograms ojects for high-dimensional Cox models

Usage

as_nomogram(
  object,
  x,
  time,
  event,
  pred.at = NULL,
  fun.at = NULL,
  funlabel = NULL
)

Arguments

object

Model object fitted by `hdnom::fit_*()` functions.

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.

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

The nomogram visualizes the model under the automatically selected "optimal" hyperparameters (e.g. lambda, alpha, gamma).

Examples

data(smart)
x <- as.matrix(smart[, -c(1, 2)])
time <- smart$TEVENT
event <- smart$EVENT
y <- survival::Surv(time, event)

fit <- fit_lasso(x, y, nfolds = 5, rule = "lambda.1se", seed = 11)

nom <- as_nomogram(
  fit, x, time, event, pred.at = 365 * 2,
  funlabel = "2-Year Overall Survival Probability"
)

print(nom)
#> Points per unit of linear predictor: 55.97875 
#> Linear predictor units per point   : 0.01786392 
#> 
#> 
#>  AGE Points
#>  15   0    
#>  20   5    
#>  25   9    
#>  30  14    
#>  35  19    
#>  40  23    
#>  45  28    
#>  50  32    
#>  55  37    
#>  60  42    
#>  65  46    
#>  70  51    
#>  75  56    
#>  80  60    
#>  85  65    
#> 
#> 
#>  AAA Points
#>  0    0    
#>  1   17    
#> 
#> 
#>  STENOSIS Points
#>  0        0     
#>  1        0     
#> 
#> 
#>  CREAT Points
#>     0    0   
#>   100    7   
#>   200   14   
#>   300   21   
#>   400   29   
#>   500   36   
#>   600   43   
#>   700   50   
#>   800   57   
#>   900   64   
#>  1000   71   
#>  1100   79   
#>  1200   86   
#>  1300   93   
#>  1400  100   
#> 
#> 
#>  IMT Points
#>  0.0  0    
#>  0.5  8    
#>  1.0 15    
#>  1.5 23    
#>  2.0 30    
#>  2.5 38    
#>  3.0 46    
#>  3.5 53    
#>  4.0 61    
#>  4.5 69    
#>  5.0 76    
#> 
#> 
#>  ALBUMIN Points
#>  1        0    
#>  2       14    
#>  3       29    
#> 
#> 
#>  Total Points 2-Year Overall Survival Probability
#>           189                                0.60
#>           168                                0.70
#>           142                                0.80
#>           100                                0.90
#>            60                                0.95
#> 
plot(nom)