[R] survfit & number of variables != number of variable names
Georges Dupret
georges.dupret at yahoo.fr
Mon Nov 19 20:07:20 CET 2012
Hi!
In answer to:
--------
I noticed that you were using what might be called an "externally
created Surv object". I have a memory that Terry Therneau has
criticized that practice. I cannot remember if it was in exactly this
situation but I might ask if setting up the model as:
cox = coxph(Surv(stime, event) ~ bucket*(today + accor + both) +
activity, data = data)
... might give the survival machinery a better handle on where
everything might be found.
------------
I tried to create the Surv object "internally" but I face the same issue:
> (cox.s = coxph(Surv(time=absence, event=(censored==FALSE)) ~
> bucket*(today) + strata(activity), data = small))
Call:
coxph(formula = Surv(time = absence, event = (censored == FALSE)) ~
bucket * (today) + strata(activity), data = small)
coef exp(coef) se(coef) z p
bucket575 0.4526 1.572 0.740 0.612 0.54
todayTRUE -0.0886 0.915 0.676 -0.131 0.90
bucket575:todayTRUE -0.1670 0.846 0.794 -0.210 0.83
Likelihood ratio test=2.32 on 3 df, p=0.509 n= 100, number of events= 100
> fit = survfit(cox.s, newdata=small[1:50,])
Error in model.frame.default(data = small[1:50, ], formula = ~bucket + :
number of variables != number of variable names
Best, and thank you for the suggestion.
ge
--
View this message in context: http://r.789695.n4.nabble.com/survfit-number-of-variables-number-of-variable-names-tp4649834p4650080.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list