5
$\begingroup$

I am using the flexmix package to estimate latent class multinomial logit models in R. In choice theory, there can be variables associated with the alternative (generic) or that vary with the agent (alternative-specific).

The nnet package that underlies FLXMRmultinom can't accommodate generic variables. So far, I haven't seen that the FLXMRcondlogit can handle alternative-specific ones.

The most flexible package for MNL models is mlogit. Has anyone seen an implementation of this for flexmix?

$\endgroup$
  • $\begingroup$ You can use dummy variables to present the alternative specific constants, if my memory is correct, these constants vary with alternatives not with agents. $\endgroup$ – user58575 Oct 14 '14 at 1:26
  • $\begingroup$ This seems like a comment, & I'm not sure it really answers the question regarding an implementation for flexmix. Can you elaborate? $\endgroup$ – gung - Reinstate Monica Oct 14 '14 at 1:43
  • $\begingroup$ What is "alternative" or "generic"? Is this a bivariate treatment assignment? Is this a latent value? Where do multinomial outcomes factor into the measurement? I'm not sure about what type of model you are describing. I'm familiar with item response theory, but I cannot tell if IRT might address your problem. $\endgroup$ – AdamO Mar 22 '18 at 17:03
2
$\begingroup$

I have used both mlogit and flexmix. But there is a more general package in R called RSGHB that can easily implement the functions of those packages, as well as some things which are more difficult, such as latent class models. (I don't have enough reputation points to add as comment--strange that one needs more points for a comment...)

| cite | improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ Yes comments require reputation >50 (perhaps answers are easier to curate). This strikes me as potentially an answer, though. Would you care to elaborate it a little? $\endgroup$ – gung - Reinstate Monica Nov 10 '14 at 18:28
2
$\begingroup$

Have you tried the brms package? Its brm function supports multinomial logistic models and category-specific variables as well. Not sure if it will do what you want, though. Something like:

mod <- brm (choice ~ agentVar1 + agentVar2 + cse (choiceVar1), family="categorical", data=yourData, prior=c (set_prior ("student_t(3, 0, 5)", class="b")))

might be what you're after. The cse is a category-specific effect, which I think might be your alternative-specific variables. I think.

Note that brms is Bayesian and does sampling. The Bayesian part may require reasonable priors to converge. (Usually you can get started with its defaults, but some kinds of regressions -- I think categorical is one of them -- are pickier. I copied/pasted a prior I used for a different categorical task that could get you started.) Bayesian statistics requires more thought up front (priors) and more checking of convergence, but it offers a lot of goodness in return. So if you're totally unfamiliar with it, this could be a big leap that doesn't make sense right now, but it's an option to consider.

The formula automatically compiles down to the Stan language, which compiles down to C++, which compiles to an executable that is run. So you need to have a C++ compiler on your system for it to work. (Probably included if you're running Linux, install the free Developer Tools under MacOS, not sure about Windows.)

brm is unbelievably flexible and supports everything from censoring and truncation to random effects and smoothers. So it pretty much supports any kind of regression you can imagine.

I'm just a very satisfied user of brms, and thought it might solve your current issue and be useful in the future as well.

| cite | improve this answer | |
$\endgroup$

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