Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mixed logit to do discrete choice analysis

    Hello, I am trying to do mixed logit analysis of discrete choice data, which is one of my PhD study. I am facing some problem:
    my variables are: origin, gender, license, review, price. There were 2 choice alternatives and the 3rd one was no buy option.
    I have prepare the data using the following code:

    gen gen_female_3=0

    gen org_northern_3=0



    gen lic_yes_3=0

    gen rev_reliable_3=0

    gen pri_3=0

    gen obs=si_no*100+ch_scene


    gen ch_scene1=ch_scene
    gen ch_scene2=ch_scene
    gen ch_scene3=ch_scene


    gen choice1=(ri_ch_==1)
    gen choice2=(ri_ch_==2)
    gen choice3=(ri_ch_==3)

    drop ch_scene
    drop ri_ch_

    reshape long ch_scene choice org_northern_ gen_female_ lic_yes_ rev_reliable_ pri_, i(obs) j(alternatives)
    xy
    rename (gen_female_ org_northern_ lic_yes_ rev_reliable_ pri_) ///
    (gen_female_ org_northern_ lic_yes_ rev_reliable_ pri_)


    sort obs alternatives
    by obs: gen total_alternatives=_N
    gen none=(alternatives==3)

    label variable none "no buy option"

    To do mixed logit model may I use the following code?

    mixlogit choice, group(obs) rand(org_northern lic_yes rev_reliable pri_ none) id(si_no) nrep(1000)


    Is that ok to use none (which is a no buy option) in the mixed logit model? If I place none there then the result is:

    Mixed logit model Number of obs = 11,757
    LR chi2(5) = 576.74
    Log likelihood = -2682.319 Prob > chi2 = 0.0000

    -------------------------------------------------------------------------------
    choice | Coefficient Std. err. z P>|z| [95% conf. interval]
    --------------+----------------------------------------------------------------
    Mean |
    org_northern_ | .3304111 .0925557 3.57 0.000 .1490053 .5118169
    lic_yes_ | .626183 .0938734 6.67 0.000 .4421946 .8101715
    rev_reliable_ | .9011545 .0822006 10.96 0.000 .7400443 1.062265
    pri_ | -1.576959 .1301601 -12.12 0.000 -1.832068 -1.32185
    none | -4.88995 .3000033 -16.30 0.000 -5.477945 -4.301954
    --------------+----------------------------------------------------------------
    SD |
    org_northern_ | 2.115211 .1570224 13.47 0.000 1.807453 2.42297
    lic_yes_ | .7918465 .2199112 3.60 0.000 .3608284 1.222865
    rev_reliable_ | 1.372655 .1071465 12.81 0.000 1.162651 1.582658
    pri_ | .3854474 .1776919 2.17 0.030 .0371778 .7337171
    none | 1.260345 .2761754 4.56 0.000 .7190513 1.801639

    -------------------------------------------------------------------------------


    If I do not use none like if I use the following code:
    mixlogit choice, group(obs) rand(org_northern lic_yes rev_reliable pri_) id(si_no) nrep(1000)

    Then the result is:

    Mixed logit model Number of obs = 11,757
    LR chi2(4) = 968.81
    Log likelihood = -2847.8303 Prob > chi2 = 0.0000

    -------------------------------------------------------------------------------
    choice | Coefficient Std. err. z P>|z| [95% conf. interval]
    --------------+----------------------------------------------------------------
    Mean |
    org_northern_ | .5993313 .118823 5.04 0.000 .3664424 .8322202
    lic_yes_ | 1.354811 .1042005 13.00 0.000 1.150582 1.55904
    rev_reliable_ | 1.334434 .0918829 14.52 0.000 1.154347 1.514521
    pri_ | .472526 .056679 8.34 0.000 .3614372 .5836148
    --------------+----------------------------------------------------------------
    SD |
    org_northern_ | 2.885606 .1606269 17.96 0.000 2.570784 3.200429
    lic_yes_ | 1.109974 .1671498 6.64 0.000 .7823661 1.437581
    rev_reliable_ | 1.578472 .1126339 14.01 0.000 1.357714 1.79923
    pri_ | -.1833003 .1084572 -1.69 0.091 -.3958725 .0292719
    -------------------------------------------------------------------------------

    The difference is the sign of price coefficient? why it is different?

    In which case I need to take price as log normal distribution? in Which case I need to use the following code?

    gen mpri= -1*pri_

    mixlogit choice , group(obs) rand(org_northern gen_female lic_yes rev_reliable pri_) ln(1) id(si_no) nrep(50)

    If I do not use "none" then multiplying price with -1 is not working. what should I do? please help.


    I am following this article to do this: Hole,2007, Fitting-mixed-logit-models-by-using-maximum-simulated-likelihood
    Last edited by Shanjida Sharmin; 04 May 2024, 08:18.
Working...
X