Re: [R] coxph and survfit issue - strata

2011-05-09 Thread Terry Therneau
> 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.


Re: [R] coxph and survfit issue - strata

2011-05-06 Thread David Winsemius


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 issue - strata

2011-05-06 Thread Eva Bouguen
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.