Important: Read this before posting to this forum

  1. This forum is for questions related to the use of Apollo. We will answer some general choice modelling questions too, where appropriate, and time permitting. We cannot answer questions about how to estimate choice models with other software packages.
  2. There is a very detailed manual for Apollo available at http://www.ApolloChoiceModelling.com/manual.html. This contains detailed descriptions of the various Apollo functions, and numerous examples are available at http://www.ApolloChoiceModelling.com/examples.html. In addition, help files are available for all functions, using e.g. ?apollo_mnl
  3. Before asking a question on the forum, users are kindly requested to follow these steps:
    1. Check that the same issue has not already been addressed in the forum - there is a search tool.
    2. Ensure that the correct syntax has been used. For any function, detailed instructions are available directly in Apollo, e.g. by using ?apollo_mnl for apollo_mnl
    3. Check the frequently asked questions section on the Apollo website, which discusses some common issues/failures. Please see http://www.apollochoicemodelling.com/faq.html
    4. Make sure that R is using the latest official release of Apollo.
  4. If the above steps do not resolve the issue, then users should follow these steps when posting a question:
    1. provide full details on the issue, including the entire code and output, including any error messages
    2. posts will not immediately appear on the forum, but will be checked by a moderator first. This may take a day or two at busy times. There is no need to submit the post multiple times.

mixed logit query

Ask questions about model specifications. Ideally include a mathematical explanation of your proposed model.
georkapo
Posts: 10
Joined: 15 May 2023, 16:49

Re: mixed logit query

Post by georkapo »

Dear Stephane,

I have calculated two models, model A : ten random coefficients, model B : ten random coefficients and I have allowed for differences between genders in the cost coefficient

Code: Select all

randcoeff[["b_cost"]] = -exp( mu_log_b_cost + sigma_log_b_cost * draws_cost + (gender == 1) * ( mu_male_cost + sigma_male_cost * draws_male_cost))
Both models estimate quite similar values, however, when I calculate the wtp I get different values. Could you help with this?
here I put the results:
Model A:

Code: Select all

asc_A                                     2.151528     0.22276       9.658     0.26878         8.005
asc_B                                     2.211906     0.23028       9.605     0.27836         7.946
asc_C                                     0.000000          NA          NA          NA            NA
mu_b_Assistance_emergency_unit            0.030000          NA          NA          NA            NA
mu_b_Assistance_emergency_call            0.160136     0.09213       1.738     0.08260         1.939
mu_b_Assistance_smart_routes              0.577922     0.12109       4.773     0.12325         4.689
mu_b_Automatic_speed_safe_distance        0.100000          NA          NA          NA            NA
mu_b_Automatic_speed_speed_limit          0.560489     0.16221       3.455     0.17030         3.291
mu_b_Automatic_speed_risky_areas          0.345235     0.16378       2.108     0.16818         2.053
mu_b_Collision_avoidance_front_side       0.100000          NA          NA          NA            NA
mu_b_Collision_avoidance_rear_side        0.345127     0.09592       3.598     0.09306         3.709
mu_b_Collision_avoidance_blind_spot       0.346942     0.10482       3.310     0.10468         3.314
mu_log_b_cost                            -4.908550     0.07708     -63.678     0.08272       -59.337
sigma_b_Assistance_emergency_unit        -0.680916     0.18195      -3.742     0.18564        -3.668
sigma_b_Assistance_emergency_call        -0.444675     0.24878      -1.787     0.26330        -1.689
sigma_b_Assistance_smart_routes           1.300542     0.17620       7.381     0.19487         6.674
sigma_b_Automatic_speed_safe_distance     0.913538     0.18647       4.899     0.19675         4.643
sigma_b_Automatic_speed_speed_limit       0.540927     0.20983       2.578     0.20854         2.594
sigma_b_Automatic_speed_risky_areas      -0.689575     0.17069      -4.040     0.16743        -4.119
sigma_b_Collision_avoidance_front_side   -0.725422     0.17067      -4.251     0.16538        -4.386
sigma_b_Collision_avoidance_rear_side     0.465637     0.23245       2.003     0.22063         2.110
sigma_b_Collision_avoidance_blind_spot   -0.934059     0.16729      -5.584     0.17004        -5.493
sigma_log_b_cost                         -1.167197     0.07783     -14.996     0.08466       -13.787
Model B

Code: Select all

asc_A                                      2.12731     0.20462      10.396     0.25029         8.499
asc_B                                      2.19177     0.21065      10.405     0.25676         8.536
asc_C                                      0.00000          NA          NA          NA            NA
mu_b_Assistance_emergency_unit             0.03000          NA          NA          NA            NA
mu_b_Assistance_emergency_call             0.13904     0.08710       1.596     0.08286         1.678
mu_b_Assistance_smart_routes               0.53068     0.11150       4.760     0.11510         4.611
mu_b_Automatic_speed_safe_distance         0.10000          NA          NA          NA            NA
mu_b_Automatic_speed_speed_limit           0.54664     0.15187       3.599     0.15773         3.466
mu_b_Automatic_speed_risky_areas           0.31619     0.15504       2.039     0.15844         1.996
mu_b_Collision_avoidance_front_side        0.10000          NA          NA          NA            NA
mu_b_Collision_avoidance_rear_side         0.32022     0.08860       3.614     0.09112         3.514
mu_b_Collision_avoidance_blind_spot        0.29924     0.09811       3.050     0.09934         3.012
mu_log_b_cost                             -5.09219     0.07935     -64.176     0.09669       -52.668
mu_male_cost                              -0.26587     0.10362      -2.566     0.12654        -2.101
sigma_b_Assistance_emergency_unit         -0.46741     0.18346      -2.548     0.23588        -1.982
sigma_b_Assistance_emergency_call         -0.53741     0.14835      -3.623     0.15022        -3.578
sigma_b_Assistance_smart_routes           -1.30353     0.16783      -7.767     0.23157        -5.629
sigma_b_Automatic_speed_safe_distance      0.92836     0.17130       5.419     0.20661         4.493
sigma_b_Automatic_speed_speed_limit       -0.40859     0.15645      -2.612     0.15647        -2.611
sigma_b_Automatic_speed_risky_areas        0.62139     0.14442       4.303     0.15242         4.077
sigma_b_Collision_avoidance_front_side     0.60242     0.16110       3.739     0.17589         3.425
sigma_b_Collision_avoidance_rear_side     -0.35168     0.20753      -1.695     0.24409        -1.441
sigma_b_Collision_avoidance_blind_spot    -0.95595     0.14599      -6.548     0.17027        -5.614
sigma_log_b_cost                           1.34944     0.08403      16.058     0.09832        13.724
sigma_male_cost                            0.54037     0.08825       6.124     0.10083         5.359
Estimation of the WTP:
Model A :

Code: Select all

> (mean(wtp_routes)); (sd(wtp_routes))
[1] 154.4723
[1] 734.7984
Model B :

Code: Select all

> (mean(wtp_routes)); (sd(wtp_routes))
[1] 263.9358
[1] 2040.514
I calculate the wtp with the same approach by using apollo_unconditionals.
There is a big difference, while the coefficients are similar. Could you give any insights on this?

I really appreciate any hint. Thank you in advance.

Best regards,
Georgios
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: mixed logit query

Post by stephanehess »

Georgios

you mean standard deviation, not standard error, I guess. When you allow for more heterogeneity, then the sd would be higher. Why are you surprised?
georkapo wrote: 29 Nov 2023, 12:32 Dear Stephane,

One additional question related to the previous one.
When I use a single random coefficient allowing for differences between men and women, there is a higher sd error for the attributes e.g.
> (mean(wtp_unit)); (sd(wtp_unit))
[1] 12.42137
[1] 587.157
while when I do not allow for differences between men and women, the sd is lower
> (mean(wtp_unit)); (sd(wtp_unit))
[1] 8.141867
[1] 360.8153
Thank you very much for your support.
Best regards,
Georgios
--------------------------------
Stephane Hess
www.stephanehess.me.uk
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: mixed logit query

Post by stephanehess »

Hi

your second model allows for differences in cost sensitivity between men and women, so it's quite normal that you would get differences in the WTP. Does that not make sense to you?

Stephane
georkapo wrote: 01 Dec 2023, 14:39 Dear Stephane,

I have calculated two models, model A : ten random coefficients, model B : ten random coefficients and I have allowed for differences between genders in the cost coefficient

Code: Select all

randcoeff[["b_cost"]] = -exp( mu_log_b_cost + sigma_log_b_cost * draws_cost + (gender == 1) * ( mu_male_cost + sigma_male_cost * draws_male_cost))
Both models estimate quite similar values, however, when I calculate the wtp I get different values. Could you help with this?
here I put the results:
Model A:

Code: Select all

asc_A                                     2.151528     0.22276       9.658     0.26878         8.005
asc_B                                     2.211906     0.23028       9.605     0.27836         7.946
asc_C                                     0.000000          NA          NA          NA            NA
mu_b_Assistance_emergency_unit            0.030000          NA          NA          NA            NA
mu_b_Assistance_emergency_call            0.160136     0.09213       1.738     0.08260         1.939
mu_b_Assistance_smart_routes              0.577922     0.12109       4.773     0.12325         4.689
mu_b_Automatic_speed_safe_distance        0.100000          NA          NA          NA            NA
mu_b_Automatic_speed_speed_limit          0.560489     0.16221       3.455     0.17030         3.291
mu_b_Automatic_speed_risky_areas          0.345235     0.16378       2.108     0.16818         2.053
mu_b_Collision_avoidance_front_side       0.100000          NA          NA          NA            NA
mu_b_Collision_avoidance_rear_side        0.345127     0.09592       3.598     0.09306         3.709
mu_b_Collision_avoidance_blind_spot       0.346942     0.10482       3.310     0.10468         3.314
mu_log_b_cost                            -4.908550     0.07708     -63.678     0.08272       -59.337
sigma_b_Assistance_emergency_unit        -0.680916     0.18195      -3.742     0.18564        -3.668
sigma_b_Assistance_emergency_call        -0.444675     0.24878      -1.787     0.26330        -1.689
sigma_b_Assistance_smart_routes           1.300542     0.17620       7.381     0.19487         6.674
sigma_b_Automatic_speed_safe_distance     0.913538     0.18647       4.899     0.19675         4.643
sigma_b_Automatic_speed_speed_limit       0.540927     0.20983       2.578     0.20854         2.594
sigma_b_Automatic_speed_risky_areas      -0.689575     0.17069      -4.040     0.16743        -4.119
sigma_b_Collision_avoidance_front_side   -0.725422     0.17067      -4.251     0.16538        -4.386
sigma_b_Collision_avoidance_rear_side     0.465637     0.23245       2.003     0.22063         2.110
sigma_b_Collision_avoidance_blind_spot   -0.934059     0.16729      -5.584     0.17004        -5.493
sigma_log_b_cost                         -1.167197     0.07783     -14.996     0.08466       -13.787
Model B

Code: Select all

asc_A                                      2.12731     0.20462      10.396     0.25029         8.499
asc_B                                      2.19177     0.21065      10.405     0.25676         8.536
asc_C                                      0.00000          NA          NA          NA            NA
mu_b_Assistance_emergency_unit             0.03000          NA          NA          NA            NA
mu_b_Assistance_emergency_call             0.13904     0.08710       1.596     0.08286         1.678
mu_b_Assistance_smart_routes               0.53068     0.11150       4.760     0.11510         4.611
mu_b_Automatic_speed_safe_distance         0.10000          NA          NA          NA            NA
mu_b_Automatic_speed_speed_limit           0.54664     0.15187       3.599     0.15773         3.466
mu_b_Automatic_speed_risky_areas           0.31619     0.15504       2.039     0.15844         1.996
mu_b_Collision_avoidance_front_side        0.10000          NA          NA          NA            NA
mu_b_Collision_avoidance_rear_side         0.32022     0.08860       3.614     0.09112         3.514
mu_b_Collision_avoidance_blind_spot        0.29924     0.09811       3.050     0.09934         3.012
mu_log_b_cost                             -5.09219     0.07935     -64.176     0.09669       -52.668
mu_male_cost                              -0.26587     0.10362      -2.566     0.12654        -2.101
sigma_b_Assistance_emergency_unit         -0.46741     0.18346      -2.548     0.23588        -1.982
sigma_b_Assistance_emergency_call         -0.53741     0.14835      -3.623     0.15022        -3.578
sigma_b_Assistance_smart_routes           -1.30353     0.16783      -7.767     0.23157        -5.629
sigma_b_Automatic_speed_safe_distance      0.92836     0.17130       5.419     0.20661         4.493
sigma_b_Automatic_speed_speed_limit       -0.40859     0.15645      -2.612     0.15647        -2.611
sigma_b_Automatic_speed_risky_areas        0.62139     0.14442       4.303     0.15242         4.077
sigma_b_Collision_avoidance_front_side     0.60242     0.16110       3.739     0.17589         3.425
sigma_b_Collision_avoidance_rear_side     -0.35168     0.20753      -1.695     0.24409        -1.441
sigma_b_Collision_avoidance_blind_spot    -0.95595     0.14599      -6.548     0.17027        -5.614
sigma_log_b_cost                           1.34944     0.08403      16.058     0.09832        13.724
sigma_male_cost                            0.54037     0.08825       6.124     0.10083         5.359
Estimation of the WTP:
Model A :

Code: Select all

> (mean(wtp_routes)); (sd(wtp_routes))
[1] 154.4723
[1] 734.7984
Model B :

Code: Select all

> (mean(wtp_routes)); (sd(wtp_routes))
[1] 263.9358
[1] 2040.514
I calculate the wtp with the same approach by using apollo_unconditionals.
There is a big difference, while the coefficients are similar. Could you give any insights on this?

I really appreciate any hint. Thank you in advance.

Best regards,
Georgios
--------------------------------
Stephane Hess
www.stephanehess.me.uk
georkapo
Posts: 10
Joined: 15 May 2023, 16:49

Re: mixed logit query

Post by georkapo »

Hi Stephane,

Thank you for your quick response.
your second model allows for differences in cost sensitivity between men and women, so it's quite normal that you would get differences in the WTP. Does that not make sense to you?
Indeed, since I allow for differences in cost, I get different values of WTP, however, it surprised me that the differences are so huge (wtp and the sd), while the estimations are quite similar, e.g., mu_Assistance_smart_routes: 0.577922, sigma_Assistance_smart_routes: 1.300542 and mu_Assistance_smart_routes: 0.53068, sigma_Assistance_smart_routes: -1.30353

Also, by allowing differences in cost sensitivity between men and women, what would be the correct estimation for the WTP?

Should I estimate first only for the b_cost and then for the mu_male_cost? how can I interpret the results?

Code: Select all

wtp_routes  <- -(unconditionals[["Assistance_smart_routes"]]/unconditionals[["b_cost"]])

Code: Select all

wtp_male_Assistance_smart_routes <- (unconditionals[["Assistance_smart_routes"]])/(unconditionals[["b_cost"]]) + (unconditionals[["Assistance_smart_routes"]])/(unconditionals[["b_cost"]]+model$estimate["mu_male_cost"]/model$estimate["sigma_male_cost"])
Thank you again, and I'm sorry for bothering you.

Best regards,
Georgios
Last edited by georkapo on 02 Dec 2023, 08:50, edited 1 time in total.
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: mixed logit query

Post by stephanehess »

Georgios

you are only comparing the parameters in the numerator of WTP there, but of course, the cost coefficient now includes a gender interaction, with an additive variance for male, so there will be a lot more heterogeneity in the cost sensitivity, and hence in WTP

Regarding computation, if you have used (as I suggested)

Code: Select all

randcoeff[["b_cost"]] = -exp( mu_log_b_cost + sigma_log_b_cost * draws_cost + (gender == 1) * ( mu_male_cost + sigma_male_cost * draws_male_cost))
then your WTP is simply

Code: Select all

wtp_routes  <- -(unconditionals[["Assistance_smart_routes"]]/unconditionals[["b_cost"]])
as unconditionals[["b_cost"]] already includes the gender interaction

Stephane & David
--------------------------------
Stephane Hess
www.stephanehess.me.uk
Post Reply