Re: [R] Survival Analysis with two different events

From: Ben Bolker <>
Date: Sun, 29 Jun 2008 18:13:34 +0000 (UTC)

sickboyedd <sickboyedd <at>> 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

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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sun 29 Jun 2008 - 18:16:26 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 29 Jun 2008 - 19:31:11 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive