And be careful - R is case-sensitive. You have "surv(...)" instead of "Surv(...)" in your code, that will probably give an error.
The coding is as you have it - 1=failure, 0=censored. Petr Christos Hatzis napsal(a): > The Surv object contains the information on the type of censoring. > Look at ?Surv > for an explanation of how censored events are represented. > > -Christos > > >> -----Original Message----- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of Lu, Jiang >> Sent: Saturday, April 28, 2007 11:10 PM >> To: r-help@stat.math.ethz.ch >> Subject: [R] how to code the censor variable for "survfit" >> >> Dear r-helpers, >> >> This is my first time to run survival analysis. Currently, I >> have a data set which contains two variables, the variable of >> time to event (or time to censoring) and the variable of >> censor indicator. For the indicator variable, it was coded as >> 0 and 1. 0 represents right censor, 1 means event of >> interest. Now I try to use "survfit" in the package of >> "survival". I wrote the following code: >>> rptsurv <- survfit(surv(time,censor)~1,data=x) >> Before I run the code, I am concerned with my 0/1 coding to >> the censor indicator because I did not see any argument in >> the syntax of "survfit", which may tell the program that >> value 1 means event. I checked the documentations and R-help >> archive, but ended in vain. >> >> Would you please kindly tell me how "survfit" treats censor variables? >> In 0/1 coding, is it the default that 1 means event and 0 >> means right censor? What if the censor was coded as 2 or 3 >> instead of 0 or 1? I means how the "survfit" knows the >> difference. In SAS, if a "lifetest" >> procedure (similar to survfit) is performed, there is an >> argument specifying which value in the censor variable is >> treated as event. >> >> I know I could just compare the results from R and from SAS >> to see the difference. However, I really want to know exactly >> how "survfit" deals with this problem. Thank you very much in advance. >> >> sincerely, >> >> Jiang Lu >> University of Pittsburgh >> >> ______________________________________________ >> R-help@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. >> >> > > ______________________________________________ > R-help@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. > -- Petr Klasterecky Dept. of Probability and Statistics Charles University in Prague Czech Republic ______________________________________________ R-help@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.