I can't reproduce the problem.

Tell us what version of R and what version of the survival package.
Create a reproducable example. I don't know if some variables are numeric and some are factors, how/where the "surv" object was defined, etc.

Terry Therneau



On 11/17/2012 05:00 AM, r-help-requ...@r-project.org wrote:
This works ok:

>  cox = coxph(surv ~ bucket*(today + accor + both) + activity, data = data)
>  fit = survfit(cox, newdata=data[1:100,])
but using strata leads to problems:

>  cox.s = coxph(surv ~  bucket*(today + accor + both) + strata(activity),
>  data = data)
>  fit.s = survfit(cox.s, newdata=data[1:100,])
Error in model.frame.default(data = data[1:100, ], formula = ~bucket +  :
   number of variables != number of variable names

Note that the following give rise to the same error:

>  fit.s = survfit(cox.s, newdata=data)
Error in model.frame.default(data = data, formula = ~bucket + today +  :
   number of variables != number of variable names

but if I use data implicitly, all is working fine:
>  fit.s = survfit(cox.s)
Any idea on how I could solve this?

Best, and thank you,

ge

______________________________________________
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