[R] survival object

Joshua Wiley jwiley.psych at gmail.com
Sun Apr 10 07:58:50 CEST 2011


On Sat, Apr 9, 2011 at 7:36 PM, Eugenio Larios
<elariosc at email.arizona.edu> wrote:
> Hi All,
>
> I am trying to do a survivorship analysis with library(survival)from a data
> set that looks like this:
> I followed a bunch of naturally germinated seedlings of an annual plant from
> germination to death (none made it to reproduce, and died in a period of ~60
> days after germination.)
> I also know the size of the seed of every individual censused. So I am
> trying to analyze seedling survival as a function of seed size.
>
> I performed 5 censuses in unequal intervals of time starting 15 days after
> germination until everyone died. Does that make my data right censored?
> So I have the following variables: seed size (as a continuous variable and
> as a categorized variable in big and small with 0=small and 1=big), the 5
> census events (with 0=dead 1=survivors)
>
> First, I want to make a survival object with Surv() but apparently this
> function only takes two intervals of time (time, and time2). Is there a way
> to include my five census events in it?

I could be wrong, but I think the form for your intervals should be:

Surv(start, stop, event)

depending how your data is stored, you may need to reshape it to a
format amenable to this (e.g., ?reshape (the function) or
reshape/reshape2 (the packages)).

> With the survival object I can go on and fit a model with
> survfit(survivalobject~seedsize,data=mydata), right?

Yes.  Although it makes the single call a bit long, I kind of like to
locate the call to Surv() within survfit(), so that it is evaluated in
an environment including the variables in "mydata".  Just to avoid
repeatedly typing "mydata" or attach()ing it

Cheers,

Josh

>
> thanks
> --
> Eugenio Larios
> PhD Student
> University of Arizona.
> Ecology & Evolutionary Biology.
> elariosc at email.arizona.edu
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list