[R] Survival analysis and comparing survival curves

David Winsemius dwinsemius at comcast.net
Thu Feb 23 20:00:14 CET 2012

On Feb 23, 2012, at 11:12 AM, R-girl wrote:

> Hei,
> I have a one simple question which does not seem to be that simple  
> as I
> cannot find any solution/answer:
> Is it possible to compare multiple survival curves in R with
> survdiff-function when there is interaction term involved in predictor
> variables (and this interaction is significant)?

I've never had a problem with survival failing to construct an  
interaction term.

> Example:
> survdiff(Surv(death,status)~treatment*gapsize)
> R is making "problems" with it ie.e. it does not want to perform the  
> test.

Is 'gapsize' a numeric vector rather than a factor?

> And all the examples I have found so far, may involve multiple  
> predictor
> variables but in additive format (e.g. treatment+gapsize).
> If survdiff is not the way to go, are there any other solutions in  
> order to
> compare statistically the curves i.e. if they differ significantly  
> from each
> other?

Without a better description of the data layout (say using hte str()  
function) and the code you have used so far, the words "the curves",  
the indefinite pronoun "they" and the phrase "each other" will remain  
far too nebulous for further comment.

> I would really appreciate if someone can answer!

Only if "someone" can provide the information requested in the Posting  
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT

More information about the R-help mailing list