nomogramEx: Extract Equations from a Nomogram

Description Usage Arguments Value Note Author(s) See Also Examples

Description

A nomogram can not be easily applied, because it is difficult to calculate the points or even the survival probability. The package, including a function of nomogramEx(), is to extract the polynomial equations to calculate the points of each variable, and the survival probability corresponding to the total points.

Usage

1
nomogramEx(nomo,np,digit)

Arguments

nomo

a object of nomogram()

np

the number of predicitons in your nomogram, for example: if you predicted 3- and 6- month, np=2, default is 2

digit

the number of decimal digits, default is 9

Value

list

the result is a list including polynomial equations to calculate the points of each variable, and the polynomial equations to calculate the probability of points

Note

The polynomial equations extracted by this package are equal and less than cubic function.

Update:

Version 1.0: 1.the order of variables in the polynomial equations is opposite. 2.the number of the demical digits can not be controled.

Version 2.0: 1.the argument 'lp' from the 'nomogram' function can not be recognized.

Author(s)

Zhicheng Du<dgdzc@hotmail.com>, Yuantao Hao<haoyt@mail.sysu.edu.cn>

See Also

nothing

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
if(require("rms")){
n <-1000
age <- rnorm(n,50,10)
sex <- factor(sample(c('female','male'),n,TRUE))
sex <- as.numeric(sex)
ddist <- datadist(age,sex)
options(datadist='ddist')
cens <- 15*runif(n)
time <- -log(runif(n))/0.02*exp(.04*(age-50)+.8*(sex=='Female'))
death <- ifelse(time <= cens,1,0)
time <- pmin(time,cens)
units(time)="month"
f <- cph(formula(Surv(time,death)~sex+age),x=TRUE,y=TRUE,surv=TRUE,time.inc=3)
surv <- Survival(f)
nomo <- nomogram(f, fun=list(function(x) surv(3,x),function(x) surv(6,x)),
  lp=TRUE,funlabel=c("3-Month Survival Prob","6-Month Survival Prob"))
nomogramEx(nomo=nomo,np=2,digit=9)
}

Example output

Loading required package: rms
Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, round.POSIXt, trunc.POSIXt, units

Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve

$RESULT
[1] "The equation of each variable as follows:"

[[2]]
       sex
1 4.678448
2 0.000000

[[3]]
[1] "points = -1.428571429 * age + 121.428571429"

[[4]]
[1] "3-Month Survival Prob = -3.83e-07 * points ^3 + 3.2391e-05 * points ^2 + -0.002171478 * points + 1.018539386"

[[5]]
[1] "6-Month Survival Prob = -2.19e-07 * points ^3 + -2.1248e-05 * points ^2 + 0.000253219 * points + 0.959302967"

nomogramEx documentation built on May 2, 2019, 10:15 a.m.