MATLAB Code to Estimate Logit-Mixed Logit Model (Preference space, fixed and random parameters)
This is a sample MATLAB code to estimate Logit-Mixed Logit Model in preference space. The example is provided for a model with 2 fixed parameters, 2 random parameters, and 3 alternatives. This code is an extension of the original code by Kenneth Train which considers all utility parameters to be random and the model is estimated in willingness-to-pay space. This code uses a simuated data. data_generation.m generate this data and give test.csv and test_save.mat as outputs. In the attached folder, main_test.m is the main file which takes test.csv and test_save.mat as inputs. The default setting is "no bootstrapping" because it would take some time to run. You can change WantBoot=1 to get the bootstrapped standard errors. You can increase the number of repetitions (NReps) to 50 to get stable standard error estimates. To get the histogram of random coefficient 1, use bar(MidEst(1,:),FreqEst(1,:)). Please cite the following papers if you use this code in any form: Bansal, P., Daziano, R. A., & Achtnicht, M. (2018). Extending the logit-mixed logit model for a combination of random and fixed parameters. Journal of choice modelling, 27, 88-96. Bansal, P., Daziano, R. A., & Achtnicht, M. (2018). Comparison of parametric and semiparametric representations of unobserved preference heterogeneity in logit models. Journal of choice modelling, 27, 97-113.