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




--
View this message in context: 
http://r.789695.n4.nabble.com/survfit-number-of-variables-number-of-variable-names-tp4649834.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.

Reply via email to