[R] coxph: how to define interaction terms?
rm
rm at wippies.se
Mon Oct 28 10:00:30 CET 2013
I’m trying to set up Cox Proptional Hazard model with interactions between
time and the covariates (which are categorical). The problem that I face is
that how to define the interactions, i.e. “x+cutStart:x”, properly.
The code below illustrates the problem. R gives the error message ” X matrix
deemed to be singular”, because “x+cutStart:x” includes too many
combinations of the dummies in the model.
Any help is much appreciated!
aml2=survSplit(aml,cut=c(10,20,30),end='time',event='status',start='start')
aml2$cutStart=as.factor(aml2$start)
coxph(Surv(start,time,status)~x+cutStart:x,data=aml2)
--
View this message in context: http://r.789695.n4.nabble.com/coxph-how-to-define-interaction-terms-tp4679162.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list