Hi, I'm trying to do a simple survival analysis on some data, and I'm having the following problem (here's my code and the error message): out <- Surv(fup,event=status) Error in Surv(fup, event = status) : argument "time2" is missing, with no default>From reading the documentation, it seems that I should be able to simplywrite: Surv(time1, event) if my data is right-censored, which it is. Help! Thanks a million, Jen -- Jennifer Dillon Doctoral Student Harvard Biostatistics Room 414B, Building 1 [[alternative HTML version deleted]]
Try using the following (without naming the arguments) - it should work. Surv(fup, status) I think what is happening is that if you use one or two arguments (unnamed), Surv assumes that you have right-censored data, with the first argument being time and the second being status. By specifying 'event' as you did, Surv assumes that you have 3 arguments of "type"=counting and it is looking for the ending time required by the counting data format and this is why you got the error. If you are not afraid of R code, type Surv (without the parentheses) to see the code behind the function. -Christos Christos Hatzis, Ph.D. Nuvera Biosciences, Inc. 400 West Cummings Park Suite 5350 Woburn, MA 01801 Tel: 781-938-3830 www.nuverabio.com> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Jennifer Dillon > Sent: Tuesday, May 01, 2007 11:16 PM > To: r-help at stat.math.ethz.ch > Subject: [R] the Surv function > > Hi, > > I'm trying to do a simple survival analysis on some data, and > I'm having the following problem (here's my code and the > error message): > > out <- Surv(fup,event=status) > Error in Surv(fup, event = status) : argument "time2" is > missing, with no default > > >From reading the documentation, it seems that I should be able to > >simply > write: Surv(time1, event) if my data is right-censored, which it is. > Help! > > Thanks a million, > > Jen > > > > -- > Jennifer Dillon > Doctoral Student > Harvard Biostatistics > Room 414B, Building 1 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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. > >
2007/5/2, Jennifer Dillon <jdillon at hsph.harvard.edu>:> Hi, > > I'm trying to do a simple survival analysis on some data, and I'm having the > following problem (here's my code and the error message): > > out <- Surv(fup,event=status) > Error in Surv(fup, event = status) : argument "time2" is missing, with no > default >I am not very familiar with this, but shouldn' t it be: out <- Surv(fup, status==1) where fup is your vector of time differences and status your vector to denote censored events (e.g. 1 is an uncensored event and 2 for a censored events). Have a look at section 12.2 of "introductory statistics with R" by P. Dalgaard -- A. Goralczyk G?ttingen, Ger.
2007/5/2, Jennifer Dillon <jdillon at hsph.harvard.edu>:> Hi, > > I'm trying to do a simple survival analysis on some data, and I'm having the > following problem (here's my code and the error message): > > out <- Surv(fup,event=status) > Error in Surv(fup, event = status) : argument "time2" is missing, with no > default > > >From reading the documentation, it seems that I should be able to simply > write: Surv(time1, event) if my data is right-censored, which it is. > Help! > > Thanks a million, > > Jen > > > > -- > Jennifer Dillon > Doctoral Student > Harvard Biostatistics > Room 414B, Building 1 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >Read this page about Applied Survival Analysis: http://www.ats.ucla.edu/stat/r/examples/asa/default.htm Rod.