[R] coxph: how to define interaction terms?

rm rm at wippies.se
Tue Oct 29 12:38:45 CET 2013


Any ideas would be much appreciated; I suspect that this problem of
constructing the dummies applies not only to function coxph but to other
regression models in R as well. Effectively, my question is how to better
control for which dummies and interactions to include in the model and which
not.

The following code shows a workaround. It works here reasonably well since x
has only two levels, but if x has more levels, constructing the dummies
manually for each level and keeping track of each of them becomes very
difficult.



A weird thing is that if onle replace line 4 with



the problem reappears. Any idea why? A numeric (0 or 1) variable produces
different interactions than a logical variable (FALSE or TRUE).



--
View this message in context: http://r.789695.n4.nabble.com/coxph-how-to-define-interaction-terms-tp4679162p4679249.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list