[R] Survival Analysis with two different events

Ben Bolker bolker at ufl.edu
Sun Jun 29 20:13:34 CEST 2008


sickboyedd <sickboyedd <at> gmail.com> writes:

> 
> 
> Hello all,
> 
> I am hoping to use survival analysis to examine whether parasite attack
> increases nest death in a species of social wasp. I therefore have data for
> 
> 1. Whether the nest "died" in the 6 week census period ("Status", where
> 1=died, 0=survived)
> 2. The day number of death/last recorded day it was observed alive.
> 3. Whether the nest was attacked by the parasite (0/1 as with 1.)
> 4. The day number of attack/ last recorded day the nest was observed without
> a parasite.
> 
> i.e. example dataset:
> 
> status   death   para   paraday
> 0           42       0       42
> 1           32       0       42
> 1           25       1       13
> 0           42       1       25 ...
> 
> I've looked over r-help, as well as in Crawley etc., but I have yet to find
> a solution. Can anyone point me in the right direction or literature?
> 

   You might want to send this to r-sig-ecology if you need further
discussion.  In the meantime, the very simplest
thing (conditioning on whether the nest was
attacked or not) would be

library(survival)
c1 = coxph(Surv(death,status)~para,data=mydata)

(you should definitely read up a bit on survival analysis,
Cox proportional hazards, etc..  I think there's a chapter
in the book by Scheiner and Gurevitch, geared towards
ecologists).

Dealing with parasite attack in a more fine-grained
way (i.e. assessing mortality before and after parasitism)
would be a little trickier, but I wouldn't worry about
it until after you've understood the first stage of
the analysis.

  Ben Bolker



More information about the R-help mailing list