I need to rank categorical variables (top 5 reasons for staying married, top five reasons for divorce). I need to find a method for dummy coding these variables, and then ranking/weighting them (for example, 5 points for first rank (eg: family), 4 points for second rank (eg:financial)... etc), to determine the most legitimate categories. I am wondering if there is a scoring system that I can use, or whether this particular method has a name (and reference)? Once I understand the frequency of categories, and the ranks/weights, then I plan to use the most meaningful categories in a regression model.
1 Answer
You are saying you have an unordered variable and you want to express it as an ordered variable but you don't know the order. I think so doing what you propose is a bad idea over just one-hot encoding them and running a regression. Here's why: suppose you find the optimal ordered ranking and rank them from 0-5. Now you fit a regression and the weight that gets assigned to this variable is say X. So every time rank goes from 1 to 2, your output goes up by X. The same if rank goes from 3 to 4. So now you have fixed the distance between ranks. You are saying the difference between 1 and 2 is exactly the same as between 3 and 4. Rather than this, do a one hot encoding. You will give your model more flexibility.