I am trying to learn the mixed logit model. To do so, I am trying to replicate the outcome provided in the appendix of a paper: "Mixed logit models: accuracy and software choice." by Chang and Lusk 2011. They are using a data set collected by Chang et al. (2009) where consumers made hypothetical choices among four beef products options with different price levels. This link directs you to the data set and the appendix by Chang and Lusk 2009.
Following is an example of the first 50 observations of this data set:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int id byte(item scenario choice price item1 item2 item3 item4 item5) 63 1 1 0 2 1 0 0 0 0 63 2 1 0 2 0 1 0 0 0 63 3 1 1 2 0 0 1 0 0 63 4 1 0 3 0 0 0 1 0 63 5 1 0 0 0 0 0 0 1 63 1 2 1 2 1 0 0 0 0 63 2 2 0 4 0 1 0 0 0 63 3 2 0 3 0 0 1 0 0 63 4 2 0 4 0 0 0 1 0 63 5 2 0 0 0 0 0 0 1 63 1 3 0 4 1 0 0 0 0 63 2 3 0 3 0 1 0 0 0 63 3 3 1 2 0 0 1 0 0 63 4 3 0 4 0 0 0 1 0 63 5 3 0 0 0 0 0 0 1 63 1 4 0 4 1 0 0 0 0 63 2 4 1 2 0 1 0 0 0 63 3 4 0 3 0 0 1 0 0 63 4 4 0 2 0 0 0 1 0 63 5 4 0 0 0 0 0 0 1 63 1 5 0 4 1 0 0 0 0 63 2 5 0 4 0 1 0 0 0 63 3 5 0 4 0 0 1 0 0 63 4 5 0 3 0 0 0 1 0 63 5 5 1 0 0 0 0 0 1 64 1 1 0 3 1 0 0 0 0 64 2 1 0 3 0 1 0 0 0 64 3 1 1 3 0 0 1 0 0 64 4 1 0 3 0 0 0 1 0 64 5 1 0 0 0 0 0 0 1 64 1 2 0 3 1 0 0 0 0 64 2 2 0 2 0 1 0 0 0 64 3 2 1 4 0 0 1 0 0 64 4 2 0 4 0 0 0 1 0 64 5 2 0 0 0 0 0 0 1 64 1 3 0 3 1 0 0 0 0 64 2 3 0 4 0 1 0 0 0 64 3 3 1 2 0 0 1 0 0 64 4 3 0 2 0 0 0 1 0 64 5 3 0 0 0 0 0 0 1 64 1 4 0 2 1 0 0 0 0 64 2 4 0 3 0 1 0 0 0 64 3 4 1 4 0 0 1 0 0 64 4 4 0 2 0 0 0 1 0 64 5 4 0 0 0 0 0 0 1 64 1 5 0 2 1 0 0 0 0 64 2 5 0 2 0 1 0 0 0 64 3 5 1 2 0 0 1 0 0 64 4 5 0 3 0 0 0 1 0 64 5 5 0 0 0 0 0 0 1 end
Code:
gen group = id*100 + scenario
global v "item1 item2 item3 item4"
mixlogit choice price, group(group) rand($v) nrep(500) // I am not take the panel structure of the data into account
// since according to the Chang and Lusk (2011)
// the panel structure is not accounted for due to software comparison purposes.
mixlbeta $v, saving(beta) nrep(500) replace // to obtain individual-specific posterior estimate.
Iteration 0: log likelihood = -285.30657 (not concave)
Iteration 1: log likelihood = -284.75061
Iteration 2: log likelihood = -283.75438 (not concave)
Iteration 3: log likelihood = -283.74349 (not concave)
Iteration 4: log likelihood = -283.65637 (not concave)
Iteration 5: log likelihood = -283.48782
Iteration 6: log likelihood = -283.21911
Iteration 7: log likelihood = -282.89736
Iteration 8: log likelihood = -282.82986
Iteration 9: log likelihood = -282.82103
Iteration 10: log likelihood = -282.82088
Iteration 11: log likelihood = -282.82088
Mixed logit model Number of obs = 1,175
LR chi2(4) = 4.99
Log likelihood = -282.82088 Prob > chi2 = 0.2885
------------------------------------------------------------------------------
choice | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
Mean |
price | -2.962468 2.496421 -1.19 0.235 -7.855363 1.930427
item1 | 8.126218 6.133239 1.32 0.185 -3.89471 20.14715
item2 | 10.60999 8.436643 1.26 0.209 -5.925525 27.14551
item3 | 7.531379 5.689952 1.32 0.186 -3.620721 18.68348
item4 | 6.029694 4.568493 1.32 0.187 -2.924387 14.98378
-------------+----------------------------------------------------------------
SD |
item1 | 2.483182 3.208171 0.77 0.439 -3.804717 8.771081
item2 | 3.199352 3.265344 0.98 0.327 -3.200605 9.599308
item3 | -3.443235 3.693573 -0.93 0.351 -10.6825 3.796035
item4 | 4.261755 4.444216 0.96 0.338 -4.44875 12.97226
------------------------------------------------------------------------------
The sign of the estimated standard deviations is irrelevant: interpret them as
being positiveTo estimate the WTP, I used the -wtp- (ssc) command as below:
Code:
wtp price $v
item1 item2 item3 item4
wtp 2.7430569 3.5814707 2.5422654 2.0353619
ll 2.1310581 3.1337195 1.8584549 .97651132
ul 3.3550558 4.0292218 3.2260759 3.0942126I have tried the following code, based on the formula given in Lusk and Briggeman (2009) to calculate the share of preferences:
Code:
use beta, clear // data set obtained from the mixlbeta post-estimation command.
foreach v in item1 item2 item3 item4 {
gen mshare_`v' = (exp(`v')/(exp(item1) + exp(item2) + ///
exp(item3) + exp(item4) + exp(0)))
}
gen mshare_item5 = (exp(0)/(exp(item1) + exp(item2) + exp(item3) + ///
exp(item4) + exp(0))) // no purchase option1 - Whether using the data set obtained from -mixlbeta- post estimation command is a correct approach to obtain the shares at all?
2 - How can I estimate this market shares assuming a price of 3$ for all options?
I understand that the question might be somewhat elementary, however, I am not very familiar with choice modeling and any help would be greatly appreciated.
Best,
Lena
References:
CHANG, J., & LUSK, J. (2011). MIXED LOGIT MODELS: ACCURACY AND SOFTWARE CHOICE. Journal of Applied Econometrics, 26(1), 167-172. Retrieved from http://www.jstor.org/stable/41057409
Chang, J. B., Lusk, J. L., & Norwood, F. B. (2009). How closely do hypothetical surveys and laboratory experiments predict field behavior?. American Journal of Agricultural Economics, 91(2), 518-534.
Hole, A. R. (2007). Fitting mixed logit models by using maximum simulated likelihood. The Stata Journal, 7(3), 388-401.
Lusk, J. L., & Briggeman, B. C. (2009). Food values. American Journal of Agricultural Economics, 91(1), 184-196.
0 Response to Mixlogit - Share of preferences / market shares
Post a Comment