gmnl package in R

gmnlscreenshotDocumentation: manual | CRAN

Authors: Mauricio Sarrias [aut, cre], Ricardo Daziano [aut]

gmnl  is a package in R for estimating logit-type models with unobserved preference heterogeneity for cross-sectional and panel data. This package expands on mlogit and implements the maximum (simulated) likelihood estimator with analytical expressions of the gradient for the following models: multinomial or conditional logit (MNL), mixed multinomial logit (MIXL), scale heterogeneity multinomial logit (S-MNL), generalized multinomial logit (G-MNL), latent class logit (LC), and mixed-mixed multinomial logit (MM-MNL).

gmnl provides the ability of constructing preference and willingness-to-pay conditional estimates at the individual level.

Please cite as: Sarrias, MA and RA Daziano. 2017. Multinomial Logit Models with Continuous and Discrete Individual Heterogeneity in R: The gmnl PackageJournal of Statistical Software 79(2), 1-46.


  1. How to constraint parameters using gmnl?
  2. Using gmnl to estimate Latent Class Multinomial Logit Models. The helper function can be downloaded here.
  3. My model is not converging? Why am I getting NAs?

Replication code

Paper: Daziano, RA, MA Sarrias and B Leard. 2017. Are consumers willing to pay to let cars drive for them? Analyzing response to autonomous vehicles. Transportation Research Part C: Emerging Technologies 78, 150-164.

Code: R code can be found here.

MATLAB code for the logit-mixed logit model in preference space

Code: posted on Mendeley


Bansal, P, RA Daziano, M Achtnicht. 2018. Comparison of Parametric and Semiparametric Representations of Unobserved Taste Heterogeneity in Choice ModelingJournal of Choice Modelling 27, 97-113.

Bansal, P, RA Daziano, M Achtnicht. 2018. Extending the logit-mixed logit model for a combination of random and fixed parametersJournal of Choice Modelling 27, 88-96.

MATLAB code for parallel implementation of the kernel MNL model

Code: posted on Mendeley

Paper: Bansal, P, RA Daziano, and N Sunder. 2019. Arriving at a decision: a semi-parametric approach to institutional birth choice in IndiaJournal of Choice Modelling 31, 86-103.

MATLAB code for the mixture-of-normals logit

Coming soon.