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. ______________________________________________ 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.