Re: [R] survival object

From: Joshua Wiley <jwiley.psych_at_gmail.com>
Date: Sat, 09 Apr 2011 22:58:50 -0700

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/

______________________________________________
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.
Received on Sun 10 Apr 2011 - 06:04:42 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 10 Apr 2011 - 06:50:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive