Supplement 1. Data and R code for analyzing extinction times of experimental Daphnia populations.
The file data.csv is a comma separated ASCII file containing extinction times for 281 populations of Daphnia magna under three levels of environmental variation. The first line is a header containing variable names. The variable treatment takes values "low", "medium", or "high" referring to the experimental treatment. The variables treatment2 and treatment3 are re-coded versions of treatment provided for convenience. The variable treatment2 assigns the level "A" to subjects in the "low" experimental treatment, assigns "B" to subjects in the "medium" experimental treatment, and assigns "C" to subjects in the "high" experimental treatment. The variable treatment3 pools subjects in the "low" and "medium" treatments, assigning them the level "A", while subjects in the "high" experimental treatment are assigned "C", as before. The variable id is a unique identifier for each population. The variable ext is a censoring variable, taking the value "1" if the population went extinct during the course of the experiment and "0" otherwise. The variable dur reports the duration of population observation, the time-to-extinction in the case of populations going extinct and the duration of the experiment otherwise.
The file DaphExt.r contains R code for performing the Cox proportional hazards regression, estimating the survival distribution using the Kaplan-Meier estimator, and reproducing figures from the text. In addition to the basic R environment, this code depends on functions in the package survival which can be obtained along with the basic R environment from the Comprehensive R Archive Network (CRAN) found at www.r-project.org.