Re: [R] coxph and survfit issue - strata
Dear users, In a study with recurrent events: My objective is to get estimates of survival (obtained through a Cox model) by rank of recurrence and by treatment group. With the following code (corresponding to a model with a global effect of the treatment=rx), I get no error and manage to obtain what I want : data-(bladder) model1-coxph(Surv(stop,event)~rx+strata(enum) +cluster(id),data=bladder) data1-data.frame(rx=1) survfit(model1,newdata=data1) But with the model with strata by treatment interaction (corresponding to a model with an effect of the treatment by rank), I get the following error: model2-coxph(Surv(stop,event)~rx*strata(enum) +cluster(id),data=bladder) data1-data.frame(rx=1) survfit(model2,newdata=data1) Erreur dans strata(enum) : objet enum non trouv? =error in strata(enum) : object enum not found You have neglected to tell us what version of R and of the survival library you are using. (As the author, I always have the newest version of course.) The example you gave works if there is no cluster statement. Your error is a surprise to me and I will look into it. Terry Therneau __ 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.
[R] coxph and survfit issue - strata
Dear users, In a study with recurrent events: My objective is to get estimates of survival (obtained through a Cox model) by rank of recurrence and by treatment group. With the following code (corresponding to a model with a global effect of the treatment=rx), I get no error and manage to obtain what I want : data-(bladder) model1-coxph(Surv(stop,event)~rx+strata(enum)+cluster(id),data=bladder) data1-data.frame(rx=1) survfit(model1,newdata=data1) But with the model with strata by treatment interaction (corresponding to a model with an effect of the treatment by rank), I get the following error: model2-coxph(Surv(stop,event)~rx*strata(enum)+cluster(id),data=bladder) data1-data.frame(rx=1) survfit(model2,newdata=data1) Erreur dans strata(enum) : objet enum non trouvé =error in strata(enum) : object enum not found Would you have any idea to help me? Thanks in advance, Eva [[alternative HTML version deleted]] __ 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.
Re: [R] coxph and survfit issue - strata
On May 6, 2011, at 6:22 PM, Eva Bouguen wrote: Dear users, In a study with recurrent events: My objective is to get estimates of survival (obtained through a Cox model) by rank of recurrence and by treatment group. With the following code (corresponding to a model with a global effect of the treatment=rx), I get no error and manage to obtain what I want : data-(bladder) model1-coxph(Surv(stop,event)~rx+strata(enum) +cluster(id),data=bladder) data1-data.frame(rx=1) survfit(model1,newdata=data1) But with the model with strata by treatment interaction (corresponding to a model with an effect of the treatment by rank), I get the following error: model2-coxph(Surv(stop,event)~rx*strata(enum) +cluster(id),data=bladder) data1-data.frame(rx=1) survfit(model2,newdata=data1) Erreur dans strata(enum) : objet enum non trouvé =error in strata(enum) : object enum not found Right. Looks like a perfectly clear error message to me you created a newdata dataframe that did not have all the necessary columns that you used on the RHS of your formula. -- 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.
[R] coxph() and survfit()
Dear All, I have a question regarding the output of survfit() when I supply a Cox model. Lets say for example: library(survival) fit - coxph(Surv(time, status == 2) ~ factor(spiders), data = pbc) fit # HR for spiders is significant newdata - data.frame(spiders = factor(0:1)) sf - survfit(fit, newdata = newdata) sum.sf - summary(sfit, times = c(2000, 2500, 3000)) # survival estimates for the yes/no spiders # and the 3 follow up times sum.sf$surv # corresponding lower limits of the # 95% CI sum.sf$low # corresponding upper limits of the # 95% CI sum.sf$up we observe that the 95% CIs overlap!! How is this possible since the HR for spiders is significant. Regards, Mura __ 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.
Re: [R] coxph() and survfit()
On Thu, 22 Oct 2009, Mura Tamakou wrote: Dear All, I have a question regarding the output of survfit() when I supply a Cox model. Lets say for example: snipped: code that doesn't quite run we observe that the 95% CIs overlap!! How is this possible since the HR for spiders is significant. It's perfectly natural. To a good approximation, the p-value for the comparison will be significant when the point estimate for each group is outside the confidence interval for the other group. Suppose you had two point estimates with standard error equal to 1.0. The standard error of the difference would be 1.414, so the p-value would be less than 0.05 if the two point estimates differ by more than 1.96*1.414. The confidence intervals will overlap if the point estimates differ by less than 1.96*2. -thomas Thomas Lumley Assoc. Professor, Biostatistics tlum...@u.washington.eduUniversity of Washington, Seattle __ 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.