View source: R/plotsurvdelay.R
plot.surv.delay | R Documentation |
surv.delay
objects
A plot of either the estimated survival functions or hazard functions is produced. If the "surv" type is selected, the survival functions for each treatment arm is produced. If the "hazard" type is selected, the hazard functions for each treatment arm is produced.
plot.surv.delay(x, ..., type="surv")
x |
An object of class |
type |
The type of plot desired. Should be "surv" if the survival functions are desired and should be "hazard" if the hazard functions are desired. |
... |
other arguments that will be passed forward to the default plot method such as |
A data.frame
with the following variables
x |
the values of the x coordinates used in the plot |
y |
the values of the y coordinates used in the plot |
trt |
an indicator of which treatment arm the (x,y) coordinate comes from |
Nicholas Henderson
## Not run:
n <- 400
cens.time <- 8
X1 <- rweibull(n, shape=2.3, scale=7)
X2 <- rweibull(n, shape=.8, scale=10)
Y1 <- pmin(X1, cens.time)
Y2 <- pmin(X2, cens.time)
e1 <- as.numeric(X1 < cens.time)
e2 <- as.numeric(X2 < cens.time)
times <- c(Y1, Y2) ## follow-up times
events <- c(e1, e2) ## event indicators
trt <- rep(c(0,1), each=n) ## treatment arm assignment
dfs.obj <- DelayedSurvFit(times, events, trt, max.times=50)
## Plot fitted survival functions
plot(dfs.obj, xlab="Survival Prob.", ylab="Time", las=1)
## Plot fitted hazard functions
plot(dfs.obj, type="hazard", xlab="Hazard", ylab="Time", las=1)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.