1
$\begingroup$

This question already has an answer here:

I have this categorical variable that represents the country for a person. How can I use this in regression model. If there had been less levels for a category I could have used dummy binary variables to encode them. But in the case of countries, there are more than 200 countries, so it doesn't make sense to use binary variables. What should I do?

Obviously, one of the ways would be to make the variable coarse, take continent instead of country to reduce the levels. But this is not what I want to do?

Lets suppose I have a categorical variable which is the user id. What should I do in this case?

$\endgroup$

marked as duplicate by whuber Nov 3 '14 at 16:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ You can create a new binary dummy for each country. This includes adding a lot of coefficients, so if you don't care about the country-specific intercept values, you can use a within-estimator. $\endgroup$ – wolfsatthedoor Nov 3 '14 at 16:02
  • $\begingroup$ stats.stackexchange.com/questions/94010 is also a duplicate. $\endgroup$ – whuber Nov 3 '14 at 16:14