Title: | Extract Equations from a Nomogram |
---|---|
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. |
Authors: | Zhicheng Du, Yuantao Hao |
Maintainer: | Zhicheng Du<[email protected]> |
License: | GPL-3 |
Version: | 3.0 |
Built: | 2025-02-25 04:16:15 UTC |
Source: | https://github.com/cran/nomogramEx |
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.
nomogramEx(nomo,np,digit)
nomogramEx(nomo,np,digit)
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 |
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 |
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.
Zhicheng Du<[email protected]>, Yuantao Hao<[email protected]>
nothing
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) }
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) }