[R] Is there an equivalent to predict(..., type="linear") of a Proportional hazard model for a Cox model instead?
Ben Rhelp
benrhelp at yahoo.co.uk
Wed Nov 24 21:26:09 CET 2010
Hi all,
Is there an equivalent to predict(...,type="linear") of a Proportional hazard
model for a Cox model instead?
For example, the Figure 13.12 in MASS (p384) is produced by:
(aids.ps <- survreg(Surv(survtime + 0.9, status) ~ state + T.categ +
pspline(age, df=6), data = Aidsp))
zz <- predict(aids.ps, data.frame(state = factor(rep("NSW", 83), levels =
levels(Aidsp$state)),
T.categ = factor(rep("hs", 83), levels = levels(Aidsp$T.categ)), age =
0:82), se = T, type = "linear")
plot(0:82, exp(zz$fit)/365.25, type = "l", ylim = c(0, 2), xlab = "age", ylab =
"expected lifetime (years)")
lines(0:82, exp(zz$fit+1.96*zz$se.fit)/365.25, lty = 3, col = 2)
lines(0:82, exp(zz$fit-1.96*zz$se.fit)/365.25, lty = 3, col = 2)
rug(Aidsp$age + runif(length(Aidsp$age), -0.5, 0.5), ticksize = 0.015)
Is it possible to achieve something similar with a Cox model instead?
Is there a more detailed explanation of the "type" option for predict.coxph than
what's in the help of predict.coxph? e.g. type=c("lp", "risk", "expected",
"terms")
thanks in advance,
Ben
More information about the R-help
mailing list