| plot.surv {Zelig} | R Documentation |
The plot.surv command generates confidence intervals for Kaplan-Meier survival curves
plot.surv(x, duration, censor, type = "line", plotcensor=TRUE,
plottimes = FALSE, int = c(0.025,0.975), ...)
x |
output from sim stored as a list. Each element of the list is the sim output for a particular survival curve. |
duration |
the duration variable (e.g. lifetime, survival, etc.). |
censor |
the censored data |
type |
the type of confidence interval. Defaults to "line", which draws vertical confidence intervals at observed event times. "poly" draws confidence regions using polygons. |
plotcensor |
default is TRUE. Plots censoring times as a rug object. |
plottimes |
default is FALSE. Plots step function with indicators at observed event times. |
int |
vector of quantile limits for the confidence interval. Default is 95% interval. |
... |
Additional parameters passed to plot. |
For survival models, {tt plot.surv()} returns vertical confidence intervals or polygon survival regions for Kaplan-Meier survival curves. You may save this plot using the commands described in the Zelig manual (http://gking.harvard.edu/zelig).
John A. Graves <graveja0@gmail.com>
The full Zelig manual is available at
http://gking.harvard.edu/zelig, and users may also wish to see
plot, lines.
## Not run:
data(coalition)
z.out1 <- zelig(Surv(duration,ciep12)~invest+numst2+crisis,
robust=TRUE,cluster="polar",model="coxph",data=coalition)
low <- setx(z.out1,numst2=0)
high <- setx(z.out1,numst2=1
# Simulate Survival Curves for Each Group
s.out1 <- sim(z.out1,x=low)
s.out2 <- sim(z.out1,x=high)
# Organize simulated output as a list
out <- list(s.out1,s.out2)
plot.surv(x = out, duration = coalition$duration, censor=coalition$ciep12,
type="line", plottimes=FALSE, plotcensor=FALSE,
main="Survival", xlab="Time", ylab="Survival")
## End(Not run)