# Categorical independent variables for logistic regression

I'm currently struggling to find a appropriate method to analyze my experiment.

Currently, I have 4 groups of subjects, and each subjects made a choice between 3 options(A or B or No choice). Below table shows a portion of my data.

Group Choice
1 A
2 A
2 B
4 A
3 No choice
1 A
2 A

My hypothesis is that, being in group 4 makes subjects shift choice from B to A. But I'm confused because there's 4 groups on a single category of independent variable and they're not ordinal.

Will it be right to shift my data as below..

Group1 Group2 Group3 Group4 Choice
O X X X A
X O X X A
X O X X B
X X X O A
X X O X No choice
O X X X A
X X X X A

..and use (multinomial) logistic regression to predict choice (A or B or Nochoice) from group number? I am thinking of seeing the effect of "being on group4" on increase of number of A choices in baseline of reference to choice B.

• Do you need all 4 binary variables to encode 1 of 4 groups? Can it lead to any problems? May 10 at 6:38
• I have the same question. I'm not sure if such approach would be correct. It would be great if there's a way to use single variable to encode all 4 groups. May 10 at 8:44
• And I also wanted to show that group 1,2,3 all does not show such effect observed from group 4. May 10 at 8:54
• I suggest you search for and read about one-hot encoding. The issue you are concerned about is commonly discussed, and there is nothing special in your problem. "It would be great if there's a way to use single variable to encode all 4 groups" - why would it be great? On the contrary, you wrote that group number is not ordinal, so encoding it with a single scalar is inappropriate. If you want, you can always regard several scalars (binary or continuous) as a single vector variable, which takes values within a certain range. May 10 at 14:46
• @RoasClack Multinomial logistic regression had a categorical, not continuous, $y$ variable, but it seems like dropping a category solved your problem. Perhaps you could post a self-answer to “close out” this question.
– Dave
May 11 at 0:52