View source: R/coxphQuantile.R
coxphQuantile | R Documentation |
Draws a quantile curve of survival distribution as a function of covariate.
coxphQuantile(phfit, xrange, p=0.5, whichx=1, otherx=NULL, ...)
phfit |
output from a proportional hazards fit. |
xrange |
the range of covariate values for which the quantiles of survival times are computed. |
p |
the probability level for the quantile (default is median). |
whichx |
if there are more than one covariates in the Cox model, the one chosen for the quantile plot. |
otherx |
the values for other covariates in the Cox model. If missing uses their average values. |
... |
additional parameters to be passed on to the lines command. |
This function is used to draw quantile curves. It requires a plot of the data (time & covariate of interest) to be present. See example.
It invisibly returns the observed failure times and the covariate values at which the estimated survival probability is (exactly) p.
Heller G. and Simonoff J.S. (1992) Prediction in censored survival data: A comparison of the proportional hazards and linear regression models. Biometrics 48, 101-115.
## Not run: library(survival)
data(pbc)
pbcfit <- coxph(Surv(time, status==2) ~ trt + log(copper), pbc,
subset=(trt>0 & copper>0))
plot(log(pbc$copper[pbc$trt>0 & pbc$copper>0]), pbc$time[pbc$trt>0 &
pbc$copper>0], pch=c("o","x")[1+pbc$status[pbc$trt>0 & pbc$copper>0]],
xlab="log Copper", ylab="Survival time")
coxphQuantile(pbcfit, c(2.5,6), whichx=2, otherx=1)
coxphQuantile(pbcfit, c(2.5,6), p=0.75, whichx=2, otherx=2, col=2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.