I've been running a Cox regression with a dummy encoded dataset. For certain reasons, I tried doing the same procedure by using factor
in R
to designate my categorical variables.
When I do this, some of the dummy encoded variables that previously violated the PH assumption are now merged with the rest of the levels in the category, and suddenly that variable no longer violates PH.
This difference could be quite important, it seems to me, since variables I previously considered to have nonPH and therefore a time interaction now do not.
I'd love to hear some thoughts on this, such as which method might be preferred and what possible implications this could have for one's analysis. I guess those time interactions I detected in the first analysis are still there but are now just diluted by the other levels). Does this mean I'm losing information by not dummy encoding?
factor
in R is dummy coding. See this page. There should be no "merging" of categories unless you asked for that. This suggests that there might have been some error in the way you originally did the dummy coding. There can't be a helpful answer unless you show an example of a categorical predictor encoded both ways, along with the associated regression coefficients. $\endgroup$