本帖最后由 pqz 于 2014-5-6 09:41 编辑
Dear all R users,
I want to draw a nomogram similar to the attached article. Can anybody konw how to draw such nomogram? thanks.
Below I gave an example from the rms package to illustrate this problem.
library(rms)
library(survival)
library(MASS)
n <- 1000
set.seed(17)
age <- rnorm(n, 50, 10)
blood.pressure <- rnorm(n, 200, 25)
treatment <- (sample(0:1, n,TRUE))
ddist <- datadist(age, blood.pressure, treatment)
options(datadist='ddist')
cens <- 15*runif(n)
h <- .02*exp(.04*(age-50)+.8*(treatment==1))
d.time <- -log(runif(n))/h
death <- ifelse(d.time <= cens,1,0)
d.time <- pmin(d.time, cens)
f <- psm(Surv(d.time,death) ~ age+blood.pressure+treatment, dist='lognormal')
surv <- Survival(f)
nom <-nomogram(f, fun=list(function(x) surv(3, x), function(x)surv(6, x)), funlabel=c("3-Month Survival Probability", "6-month Survival Probability"))
plot(nom, xfrac=.7)
#end
In this example, treatment, for example, can be hypotensive therapy. 0 denote not receiving treatment, 1 denote receiving treatment.
My problem:
I want to predict the benefit of hypotensive therapy for these high blood pressure populations. So I want to draw nomograms for receiving treatment (i.e., the variable = 1) or not receiving treatment (i.e., the variable = 0), respectively. Could anyone give me some methods to set the arguments in the nomogram function.
many thanks
|