I'm aware that factors are the proper way to handle categorical variables but the explanation gets a little confusing when we start having factors with multiple levels.

For example, let's say I have a factor factor(department,levels=c('Finance','HR','Sales','Marketing'))

Now when I run a Cox regression to measure employee turnover, it will use Finance as the reference, or what ever reference I assign it using the relevelfunction. However, the interpretation is then confusing. I'm saying that if the exp(coef) is >1 for HR, I'm saying there is an increased risk in leaving the company for a member of HR compared to Finance. But the comparison is almost meaningless, because really I want to say "Increased risk of leaving because I'm in HR, compared to every other department".

So if I use dummy variables here, then I can say that, correct? If Department_HR is at an increase risk it's accounting for all other departments. Am I thinking about this the right way? I have read elsewhere that using one-hot encoding or dummy variable is less than ideal for survival analysis, could someone explain why this might be the case too?

  • $\begingroup$ In a word: yes. That is the way to go $\endgroup$ – Repmat Nov 7 '18 at 17:45
  • $\begingroup$ so use dummy variables? $\endgroup$ – Ted Mosby Nov 7 '18 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.