On Apr 16, 2012, at 1:02 PM, robgriffin247 wrote:

actually, maybe I haven't quite solved this - the plot doesn't appear to
include the 23 that are still alive at the end.

I have tried using a status variable (1 or 0 dependant upon survival as in
page 800, roughly, in the R book)
...
Call: survfit(formula = Surv(ssl$long, ssl$status) ~ ssl$sex)
23 observations deleted due to missingness

(these 23 will be the 23 long - longevity - scores of NA)

If a case is censored you need to code the longevity value as the duration at last observation, .... not NA. (Crawley's "R Book" is not particularly good at explaining this or many other aspects of R, IMO).

The code will take care of the censoring because you code its status as "alive" == 0 as of last observation. When I do this, I create my survival-years as:

surv.yr <- ifelse(status, death.dt-entry.dt, study.close.dt - entry.dt )/365.25

--
David.

and with the etype
(http://stat.ethz.ch/R-manual/R-devel/library/survival/html/survfit.formula.html )
and censor=T
(http://stat.ethz.ch/R-manual/R-devel/library/survival/html/survfit.coxph.html ) arguments but I can't seem to get them to work, maybe it's because its a
monday night, but I seem to have hit a dead end... bad times.


robgriffin247 wrote

Hi David thanks for the help, i was just looking back to say I have found
my solution (i think) and as you suggested survfit was the way to go.

my solution was this:
model<-survfit(Surv(a$long)~a$sex)
plot(model,ylab="proportion alive",xlab="time (days)",col=c("red","blue"))



--
View this message in context: 
http://r.789695.n4.nabble.com/Survival-Curves-tp4561685p4562155.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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.

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@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.

Reply via email to