Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

There's a way to do survival analysis of two (or more I suppose) mutually exclusive competing risks as a mixture of two different survival curves. Something like what you see in A.C. Ghani et al. Methods for Estimating the Case Fatality Ratio for a Novel, Emerging Infectious Disease. American Journal of Epidemiology (2005) Vol. 162, No. 5

What I'm looking for is a package that would help produce something like this figure:

enter image description here

Where the survival curve of one outcome, and 1-the survival curve of the other outcome will eventually meet at a particular point that is the mixture of the two outcomes.

share|improve this question
You may want to consider asking this on SO, as it appears to be mainly about how to get R to do something. – gung Aug 19 '12 at 2:21
@gung I considered it - I picked stats.SE because it's closer to a statistics methods/programming question in my mind, as the composition of two KM curves in a mixture isn't just an exercise in programming. But I could be wrong, and I won't object to it being migrated. – EpiGrad Aug 19 '12 at 2:25
I haven't got a full answer, but a place to look is "modifying the ODS template for survival plots" in the SAS documentation for PROC LIFETEST. Alternatively, you could output the needed data (using OUTEST, I think) and then make both lines fairly easily in PROC SGPLOT with SCATTER, but that wouldn't be exactly what you show. – Peter Flom Aug 19 '12 at 6:17
Probably this is a oversimplified suggestion, but what about "regular" competing risks? You can draw the CIF (cum. inc. function) for the first event and 1-CIF for the other one. If you have no other competing risks (i.e. these 2 events are the only possible events), the 2 curves will eventually converge. (see for example ncbi.nlm.nih.gov/pubmed/14992828) – andrea Aug 19 '12 at 7:13
@andrea Usually "regular" competing risks assumes that the outcome not being modeled at the time is censored - something I'd like to question in this particular case, as the counterfactual that's implied by that is absurd in my setting. Beyond that, the answer is "because I'm trying to validate a parametric mixture of two survival curves with a non-parametric approach". – EpiGrad Aug 19 '12 at 16:09

1 Answer

In R, a survfit.object---returned by survfit()---stores a fitted survival curve. In particular, this object contains the time points at which the curve has a step and the ordinates at those points. You can therefore construct the survival function, $t\mapsto \hat{S}(t)$, by constant interpolation. Here is the way I would do this:

km <- summary(survfit(Surv(time, event) ~ 1, data=data))
S <- approxfun(km$time, km$surv,
               method="constant", f=0, yleft=1, rule=2)

Now, S can be used as any user-defined function in R: in particular, you can evaluate S(t) at any time t, you can make plots using plot(), and you can superimpose two K-M curves on the same graph using lines(), ...

Hope this helps!

share|improve this answer
The question then is how to get a survfit.object that represents a mixture of two survival curves, rather than two independently occurring curves. – EpiGrad Aug 19 '12 at 16:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.