I'm running a choice model comparing how users choose between multiple options in an app.

I have the data formatted for use with MLogit:enter image description here

Price and dist_rank_cat are features that vary by alternative and by choice_event. When I run a model using just these features, the model converges and I get coefficients. The code to run the model is:

choice_model <- mlogit(choice ~ price + dist_rank_cat,
                   data = choice_df,
                   chid.var = 'api_event_id',
                   alt.var = 'location_id',
                   choice = 'choice',
                   shape = "long",
                   reflevel = '3834',
                   print.level = 3)

Lot_dummy is a feature that varies across alternative, but does not change for each choice event (like a static product attribute).

When I add it to the model, it fails to converge and I get an error:

enter image description here

I don't completely understand how Mlogit wants you to specify different types of features and assume I am messing something up in the model definition that is causing this error.

  • $\begingroup$ Is lot_dummy a categorical variable? If so, is that how it is defined in R? $\endgroup$
    – André.B
    Nov 21, 2019 at 21:58
  • $\begingroup$ It's a boolean and I define it as a logical using as.logical() $\endgroup$
    – ctd25
    Nov 21, 2019 at 22:02
  • $\begingroup$ I think this might hold some answers: stats.stackexchange.com/questions/76488/… $\endgroup$
    – André.B
    Nov 24, 2019 at 21:32


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.