nomogram
Nomogram is a graphical calculating device, a two-dimensional diagram designed to allow the approximate graphical computation of a function (wiki).
We can make nomogram using "rms" package.
I executed example(nomogram) and result is below.
This result obtained by logistic analysis.
library(rms) set.seed(17) # so can reproduce the results n <- 1000 # define sample size age <- rnorm(n, 50, 10) blood.pressure <- rnorm(n, 120, 15) cholesterol <- rnorm(n, 200, 25) sex <- factor(sample(c('female','male'), n,TRUE)) L <- .4*(sex=='male') + .045*(age-50) + (log(cholesterol - 10)-5.2)*(-2*(sex=='female') + 2*(sex=='male')) y <- ifelse(runif(n) < plogis(L), 1, 0) ddist <- datadist(age, blood.pressure, cholesterol, sex) options(datadist='ddist') f <- lrm(y ~ lsp(age,50)+sex*rcs(cholesterol,4)+blood.pressure) nom <- nomogram(f, fun = function(x)1/(1+exp(-x)), fun.at = c(.001,.01,.05,seq(.1,.9,by=.1),.95,.99,.999), funlabel = "Risk of Death") plot(nom, xfrac=.45) print(nom)
Japanese nomogram of prostate cancer is below.
http://www.tmd.ac.jp/med/uro/practice/cure/nomogram.html
And survplot function is useful to visualize survival analysis.
cens <- 15*runif(n) h <- .02*exp(.04*(age-50)+.8*(sex=='female')) dt <- -log(runif(n))/h label(dt) <- 'Follow-up Time' e <- ifelse(dt <= cens,1,0) dt <- pmin(dt, cens) units(dt) <- "Year" dd <- datadist(age, sex) options(datadist='dd') S <- Surv(dt,e) f <- cph(S ~ pol(age,2)*strat(sex), x=TRUE, y=TRUE) survplot(f, sex=., n.risk=TRUE) survplot(f, sex=., logt=TRUE, loglog=TRUE) f <- survfit(S ~ sex) survplot(f)