[R] survfit & number of variables != number of variable names

Georges Dupret georges.dupret at yahoo.fr
Sat Nov 17 03:05:12 CET 2012


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.



More information about the R-help mailing list