4
$\begingroup$

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.

$\endgroup$
1
2
$\begingroup$

If you use mlogit to analyse your data, then I would advise you to also use mlogit.data to put the data in the right shape. Regarding mlogit, you can specify random coeff with the rpar command (eg rpar=c(A='n') means that A is a random effect which is normally distributed) - if you only want to account for the panel nature of the data then specify panel=TRUE

$\endgroup$
5
  • $\begingroup$ 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. $\endgroup$ – jjcii Mar 2 '19 at 3:18
  • $\begingroup$ You can't specify "subID" as a predictor - It is simply a variable describing the structure of the data. I think the correct syntax would be something like: choice ~ 1 + group, rpar=c(group='n'). I think it is fine to specify a factor as random parameter - Mlogit should automatically create dummy variables for the different modalities and then apply the selected distribution to the dummies (so if you have 4 dummies and specify a normal distribution, mlogit will estimate 4 mean and 4 variance parameters - You can also estimate covariance parameters with the CORR option [From what I remember]) $\endgroup$ – Nicolas K Mar 2 '19 at 8:37
  • $\begingroup$ 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? $\endgroup$ – jjcii Mar 2 '19 at 17:46
  • $\begingroup$ Rpar only admits alt-specific variables. If your are interested in FE for group and to account for panel nature of data - then forget about rpar and simply use the panel option - not sure how to specify FE in mlogit - eventually do it manually (create dummy variables) $\endgroup$ – Nicolas K Mar 2 '19 at 18:35
  • $\begingroup$ 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! $\endgroup$ – jjcii Mar 2 '19 at 22:32

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.