[R] Difference in Kaplan-Meier estimates plus CI
Terry Therneau
therneau at mayo.edu
Thu Mar 8 15:08:10 CET 2012
--begin included message --
I thought this would be trivial, but I can't find a package or function
that does this.
I'm hoping someone can guide me to one.
Imagine a simple case with two survival curves (e.g. treatment &
control).
I just want to calculate the difference in KM estimates at a specific
time
point (e.g. 1 year) plus the estimate's 95% CI. The former is
straightforward, but the estimates not so much.
-------------- end inclusion ----------
As others have pointed out, use "survfit". Because the curves are step
functions, they likely won't have a stored value in the data at exactly
365 days. The summary() function for survival curves allows you to read
off the curve's values at any arbitrary time point.
A note on standard errors: S(t) +- std is a terrible confidence
interval. You will be much more accurate if you use log scale. (Some
argue for logit or log-log, in truth they work well.) If n is large
enough, however, you should be ok.
Terry T.
More information about the R-help
mailing list