# Random effects for a mixed multinomial logistic regression in R?

I have a dataset in which individuals, each belonging to a particular group, repeatedly chose between multiple discrete outcomes. Something akin to:

subID  group   choice
1      Red     A
1      Red     B
2      Blue    B
2      Blue    B
2      Blue    C
3      Red     A
3      Red     B


I'm interested in how group membership predicts choice, and want to account for non-independence of observations due to repeated choices being made by the same individuals. In turn, I planned to implement a mixed multinomial regression treating subID as a random effect.

It would appear that mlogit is a common route for mixed logits. However, I am a bit unclear as to how to set the desired random effect. I was wondering:

1. Does that seem like the best approach for R-based analysis?

2. In reviewing the discussions had here and here, I'm a bit thrown off by the mlogit scheme. Can I indeed account for subID via the rpar argument?

Any guidance would be thoroughly appreciated.

• Thank you, quite helpful. I've successfully shaped the data to long form. However, I'm now struggling with the mlogit arguments. I've tried the following: mlogit(choice ~ subID | group, rpar=c(subID="n"), panel=TRUE, data = mydata) However, this returns the following: Error in mlogit.start(formula = formula, data = data, mf = mf, start = start, : unknown random parameter Any suggestions on how to correctly enter these needed arguments? Additionally, is it correct to set subID, a factor, to a normal distribution? Many thanks. – jjcii Mar 2 '19 at 3:18
• Unfortunately that results in the same error. I was under the impression that that syntax would implement a random effect for group (for which I'm actually interested in a fixed effect) rather than for the individual. Should group be entered as | group rather than + group in this case? (see link) Additionally, revisiting the vignettes, it seems covariates used with rpar must be alternative specific. To clarify: if within mlogit.data ind.var = subID, does that already account for the repeated observations across individuals? Is rpar even needed in this case? – jjcii Mar 2 '19 at 17:46
• Thanks, much clearer now. It seems the panel argument requires the inclusion of the rpar argument (Error: panel is only relevant for mixed logit models), so I still need to figure out whether the effect of individual as choice index needs to be accounted for by some other means (vs. is automatically accounted for when setting that variable as the ind.var in mlogit.data). In any case, knowing I don't need to implement rpar is quite helpful! – jjcii Mar 2 '19 at 22:32