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 model result

Ask questions about the results reported after estimation. If the output includes errors, please include your model code if possible.
Post Reply
ramkumar
Posts: 5
Joined: 02 Jun 2023, 16:53

Mixed logit model result

Post by ramkumar »

Dr. Hess,
I am running a mixed logit model (correlated preference space) for a choice experiment (3 alternatives including a status quo). In attached results (I removed matrix related results due to space limitations), land, dist, density, buck, cwd and fee are choice specific variables, and Q4_lease is individual specific variables. When I have 500 draws, it produces results with numeric value but when I used 1000 draws it produces results with NA. Would you tell me what happened here. I am quite new for Apollo.

Another my data is from two surveys (email and mail), how can I address this issue while modeling mixed logit.

Ram

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Model run by ram using Apollo 0.2.9 on R 4.3.0 for Windows.
www.ApolloChoiceModelling.com

Model name : MMNL_preference_space_correlated
Model description : Mixed logit model on Swiss route choice data, correlated all normals except fee, Lognormals in utility space
Model run at : 2023-06-10 08:55:37.316715
Estimation method : bfgs
Model diagnosis : iteration limit exceeded
Number of individuals : 1858
Number of rows in database : 10770
Number of modelled outcomes : 10770

Number of cores used : 19
Number of inter-individual draws : 1000 (mlhs)

LL(start) : -7988.31
LL at equal shares, LL(0) : -11832.05
LL at observed shares, LL(C) : -11797.03
LL(final) : -7717.94
Rho-squared vs equal shares : 0.3477
Adj.Rho-squared vs equal shares : 0.3389
Rho-squared vs observed shares : 0.3458
Adj.Rho-squared vs observed shares : 0.3371
AIC : 15643.87
BIC : 16401.46

Estimated parameters : 104
Time taken (hh:mm:ss) : 10:01:55.95
pre-estimation : 01:57:0.39
estimation : 08:03:8.63
post-estimation : 00:01:46.93
Iterations : 201 (iteration limit exceeded)

Unconstrained optimisation.

Estimates:
Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0)
mu_b_asc_3 -4.394655 NA NA NA NA
sigma_b_asc_3 -4.269454 NA NA NA NA
mu_b_asc_3_shift_Q4_lease -0.567458 NA NA NA NA
sigma_b_asc_3_asc_3_shift_Q4_lease 0.434746 NA NA NA NA
sigma_b_asc_3_shift_Q4_lease -0.469321 NA NA NA NA
mu_b_land_h -0.664842 NA NA NA NA
sigma_b_asc_3_land_h 0.371799 NA NA NA NA
sigma_b_asc_3_shift_Q4_lease_land_h -0.421615 NA NA NA NA
sigma_b_land_h 1.873170 NA NA NA NA
mu_b_land_m -0.497596 NA NA NA NA
sigma_b_asc_3_land_m 0.633776 NA NA NA NA
sigma_b_asc_3_shift_Q4_lease_land_m -0.982718 NA NA NA NA
sigma_b_land_h_land_m 0.860014 NA NA NA NA
sigma_b_land_m -0.680392 NA NA NA NA
mu_b_dist_h -2.122407 NA NA NA NA
sigma_b_asc_3_dist_h -0.109559 NA NA NA NA
sigma_b_asc_3_shift_Q4_lease_dist_h 0.584653 NA NA NA NA
sigma_b_land_h_dist_h 0.330659 NA NA NA NA
sigma_b_land_m_dist_h 0.751808 NA NA NA NA
sigma_b_dist_h 2.038087 NA NA NA NA
mu_b_dist_m -0.720312 NA NA NA NA
sigma_b_asc_3_dist_m 0.109498 NA NA NA NA
sigma_b_asc_3_shift_Q4_lease_dist_m 0.365468 NA NA NA NA
sigma_b_land_h_dist_m 0.036827 NA NA NA NA
sigma_b_land_m_dist_m 0.757443 NA NA NA NA
sigma_b_dist_h_dist_m 0.597640 NA NA NA NA
sigma_b_dist_m 0.362304 NA NA NA NA
mu_b_density_h 0.423925 NA NA NA NA
sigma_b_asc_3_density_h -0.173381 NA NA NA NA
sigma_b_asc_3_shift_Q4_lease_density_h -0.587790 NA NA NA NA
sigma_b_land_h_density_h -0.192482 NA NA NA NA
sigma_b_land_m_density_h -0.345404 NA NA NA NA
sigma_b_dist_h_density_h 0.508342 NA NA NA NA
sigma_b_dist_m_density_h 0.725793 NA NA NA NA
sigma_b_density_h 0.960617 NA NA NA NA
mu_b_density_m 0.116706 NA NA NA NA
sigma_b_asc_3_density_m 0.042350 NA NA NA NA
sigma_b_asc_3_shift_Q4_lease_density_m -0.192343 NA NA NA NA
sigma_b_land_h_density_m 0.192035 NA NA NA NA
sigma_b_land_m_density_m 0.325010 NA NA NA NA
sigma_b_dist_h_density_m -0.198542 NA NA NA NA
sigma_b_dist_m_density_m 0.784007 NA NA NA NA
sigma_b_density_h_density_m 0.629300 NA NA NA NA
sigma_b_density_m -0.269223 NA NA NA NA
mu_b_buck_h 2.478973 NA NA NA NA
sigma_b_asc_3_buck_h -1.299220 NA NA NA NA
sigma_b_asc_3_shift_Q4_lease_buck_h -0.937637 NA NA NA NA
sigma_b_land_h_buck_h 0.481258 NA NA NA NA
sigma_b_land_m_buck_h 0.330848 NA NA NA NA
sigma_b_dist_h_buck_h -0.038747 NA NA NA NA
sigma_b_dist_m_buck_h 1.173530 NA NA NA NA
sigma_b_density_h_buck_h -0.291361 NA NA NA NA
sigma_b_density_m_buck_h 0.596127 NA NA NA NA
sigma_b_buck_h 2.259204 NA NA NA NA
mu_b_buck_m 1.548740 NA NA NA NA
sigma_b_asc_3_buck_m -0.601722 NA NA NA NA
sigma_b_asc_3_shift_Q4_lease_buck_m -0.417504 NA NA NA NA
sigma_b_land_h_buck_m -0.085788 NA NA NA NA
sigma_b_land_m_buck_m -0.005099 NA NA NA NA
sigma_b_dist_h_buck_m 0.253799 NA NA NA NA
sigma_b_dist_m_buck_m 0.922804 NA NA NA NA
sigma_b_density_h_buck_m -0.252742 NA NA NA NA
sigma_b_density_m_buck_m -0.021917 NA NA NA NA
sigma_b_buck_h_buck_m 1.386482 NA NA NA NA
sigma_b_buck_m -0.271350 NA NA NA NA
mu_b_cwd_h -2.780740 NA NA NA NA
sigma_b_asc_3_cwd_h -0.603739 NA NA NA NA
sigma_b_asc_3_shift_Q4_lease_cwd_h -1.631804 NA NA NA NA
sigma_b_land_h_cwd_h -0.436876 NA NA NA NA
sigma_b_land_m_cwd_h 1.156099 NA NA NA NA
sigma_b_dist_h_cwd_h 0.021420 NA NA NA NA
sigma_b_dist_m_cwd_h 0.131067 NA NA NA NA
sigma_b_density_h_cwd_h -0.729414 NA NA NA NA
sigma_b_density_m_cwd_h -1.336600 NA NA NA NA
sigma_b_buck_h_cwd_h -0.868223 NA NA NA NA
sigma_b_buck_m_cwd_h 0.146436 NA NA NA NA
sigma_b_cwd_h 0.613044 NA NA NA NA
mu_b_cwd_m -0.859301 NA NA NA NA
sigma_b_asc_3_cwd_m -0.325173 NA NA NA NA
sigma_b_asc_3_shift_Q4_lease_cwd_m -0.946269 NA NA NA NA
sigma_b_land_h_cwd_m -0.595974 NA NA NA NA
sigma_b_land_m_cwd_m 0.640253 NA NA NA NA
sigma_b_dist_h_cwd_m -0.534931 NA NA NA NA
sigma_b_dist_m_cwd_m 0.302092 NA NA NA NA
sigma_b_density_h_cwd_m -0.209857 NA NA NA NA
sigma_b_density_m_cwd_m -0.701394 NA NA NA NA
sigma_b_buck_h_cwd_m -0.341320 NA NA NA NA
sigma_b_buck_m_cwd_m -0.491618 NA NA NA NA
sigma_b_cwd_h_cwd_m 0.493179 NA NA NA NA
sigma_b_cwd_m -0.077413 NA NA NA NA
mu_log_b_fee -3.236465 NA NA NA NA
sigma_b_asc_3_fee 0.300379 NA NA NA NA
sigma_b_asc_3_shift_Q4_lease_fee 0.093884 NA NA NA NA
sigma_b_land_h_fee -0.555935 NA NA NA NA
sigma_b_land_m_fee 1.135949 NA NA NA NA
sigma_b_dist_h_fee 0.137179 NA NA NA NA
sigma_b_dist_m_fee -0.247979 NA NA NA NA
sigma_b_density_h_fee 0.696202 NA NA NA NA
sigma_b_density_m_fee -0.149786 NA NA NA NA
sigma_b_buck_h_fee 0.030079 NA NA NA NA
sigma_b_buck_m_fee -0.586774 NA NA NA NA
sigma_b_cwd_h_fee 0.909040 NA NA NA NA
sigma_b_cwd_m_fee 0.972526 NA NA NA NA
sigma_log_b_fee 2.125332 NA NA NA NA


Overview of choices for MNL model component :
alt1 alt2 alt3
Times available 10770.00 10770.00 10770.00
Times chosen 3409.00 4002.00 3359.00
Percentage chosen overall 31.65 37.16 31.19
Percentage chosen when available 31.65 37.16 31.19

......

......


[ reached getOption("max.print") -- omitted 95 rows ]

20 worst outliers in terms of lowest average per choice prediction:
ID Avg prob per choice
1790 0.08176748
2895 0.11617618
2920 0.12105359
248 0.13217016
703 0.13247302
6226 0.13619938
4982 0.13889874
2676 0.14020799
4817 0.14204118
3178 0.14608817
2199 0.14891646
1996 0.14979989
2952 0.15368844
738 0.16109423
4815 0.16959915
3935 0.17088681
4925 0.18064055
3976 0.18196042
291 0.18324622
3966 0.18425635

Changes in parameter estimates from starting values:
Initial Estimate Difference
mu_b_asc_3 -3.31547 -4.394655 -1.079185
sigma_b_asc_3 -3.73269 -4.269454 -0.536768
mu_b_asc_3_shift_Q4_lease -0.75167 -0.567458 0.184211
sigma_b_asc_3_asc_3_shift_Q4_lease 0.00000 0.434746 0.434746
sigma_b_asc_3_shift_Q4_lease -0.80466 -0.469321 0.335342
mu_b_land_h -0.40639 -0.664842 -0.258451
sigma_b_asc_3_land_h 0.00000 0.371799 0.371799
sigma_b_asc_3_shift_Q4_lease_land_h 0.00000 -0.421615 -0.421615
sigma_b_land_h 0.80867 1.873170 1.064502
mu_b_land_m -0.36650 -0.497596 -0.131097
sigma_b_asc_3_land_m 0.00000 0.633776 0.633776
sigma_b_asc_3_shift_Q4_lease_land_m 0.00000 -0.982718 -0.982718
sigma_b_land_h_land_m 0.00000 0.860014 0.860014
sigma_b_land_m -1.14237 -0.680392 0.461973
mu_b_dist_h -1.53595 -2.122407 -0.586455
sigma_b_asc_3_dist_h 0.00000 -0.109559 -0.109559
sigma_b_asc_3_shift_Q4_lease_dist_h 0.00000 0.584653 0.584653
sigma_b_land_h_dist_h 0.00000 0.330659 0.330659
sigma_b_land_m_dist_h 0.00000 0.751808 0.751808
sigma_b_dist_h 1.30928 2.038087 0.728807
mu_b_dist_m -0.53838 -0.720312 -0.181929
sigma_b_asc_3_dist_m 0.00000 0.109498 0.109498
sigma_b_asc_3_shift_Q4_lease_dist_m 0.00000 0.365468 0.365468
sigma_b_land_h_dist_m 0.00000 0.036827 0.036827
sigma_b_land_m_dist_m 0.00000 0.757443 0.757443
sigma_b_dist_h_dist_m 0.00000 0.597640 0.597640
sigma_b_dist_m 0.01741 0.362304 0.344896
mu_b_density_h 0.19976 0.423925 0.224165
sigma_b_asc_3_density_h 0.00000 -0.173381 -0.173381
sigma_b_asc_3_shift_Q4_lease_density_h 0.00000 -0.587790 -0.587790
sigma_b_land_h_density_h 0.00000 -0.192482 -0.192482
sigma_b_land_m_density_h 0.00000 -0.345404 -0.345404
sigma_b_dist_h_density_h 0.00000 0.508342 0.508342
sigma_b_dist_m_density_h 0.00000 0.725793 0.725793
sigma_b_density_h 0.89195 0.960617 0.068664
mu_b_density_m 0.02665 0.116706 0.090054
sigma_b_asc_3_density_m 0.00000 0.042350 0.042350
sigma_b_asc_3_shift_Q4_lease_density_m 0.00000 -0.192343 -0.192343
sigma_b_land_h_density_m 0.00000 0.192035 0.192035
sigma_b_land_m_density_m 0.00000 0.325010 0.325010
sigma_b_dist_h_density_m 0.00000 -0.198542 -0.198542
sigma_b_dist_m_density_m 0.00000 0.784007 0.784007
sigma_b_density_h_density_m 0.00000 0.629300 0.629300
sigma_b_density_m 0.03339 -0.269223 -0.302613
mu_b_buck_h 1.51880 2.478973 0.960172
sigma_b_asc_3_buck_h 0.00000 -1.299220 -1.299220
sigma_b_asc_3_shift_Q4_lease_buck_h 0.00000 -0.937637 -0.937637
sigma_b_land_h_buck_h 0.00000 0.481258 0.481258
sigma_b_land_m_buck_h 0.00000 0.330848 0.330848
sigma_b_dist_h_buck_h 0.00000 -0.038747 -0.038747
sigma_b_dist_m_buck_h 0.00000 1.173530 1.173530
sigma_b_density_h_buck_h 0.00000 -0.291361 -0.291361
sigma_b_density_m_buck_h 0.00000 0.596127 0.596127
sigma_b_buck_h 1.16686 2.259204 1.092339
mu_b_buck_m 0.93389 1.548740 0.614851
sigma_b_asc_3_buck_m 0.00000 -0.601722 -0.601722
sigma_b_asc_3_shift_Q4_lease_buck_m 0.00000 -0.417504 -0.417504
sigma_b_land_h_buck_m 0.00000 -0.085788 -0.085788
sigma_b_land_m_buck_m 0.00000 -0.005099 -0.005099
sigma_b_dist_h_buck_m 0.00000 0.253799 0.253799
sigma_b_dist_m_buck_m 0.00000 0.922804 0.922804
sigma_b_density_h_buck_m 0.00000 -0.252742 -0.252742
sigma_b_density_m_buck_m 0.00000 -0.021917 -0.021917
sigma_b_buck_h_buck_m 0.00000 1.386482 1.386482
sigma_b_buck_m 0.08238 -0.271350 -0.353728
mu_b_cwd_h -1.79517 -2.780740 -0.985570
sigma_b_asc_3_cwd_h 0.00000 -0.603739 -0.603739
sigma_b_asc_3_shift_Q4_lease_cwd_h 0.00000 -1.631804 -1.631804
sigma_b_land_h_cwd_h 0.00000 -0.436876 -0.436876
sigma_b_land_m_cwd_h 0.00000 1.156099 1.156099
sigma_b_dist_h_cwd_h 0.00000 0.021420 0.021420
sigma_b_dist_m_cwd_h 0.00000 0.131067 0.131067
sigma_b_density_h_cwd_h 0.00000 -0.729414 -0.729414
sigma_b_density_m_cwd_h 0.00000 -1.336600 -1.336600
sigma_b_buck_h_cwd_h 0.00000 -0.868223 -0.868223
sigma_b_buck_m_cwd_h 0.00000 0.146436 0.146436
sigma_b_cwd_h -1.17076 0.613044 1.783804
mu_b_cwd_m -0.73468 -0.859301 -0.124622
sigma_b_asc_3_cwd_m 0.00000 -0.325173 -0.325173
sigma_b_asc_3_shift_Q4_lease_cwd_m 0.00000 -0.946269 -0.946269
sigma_b_land_h_cwd_m 0.00000 -0.595974 -0.595974
sigma_b_land_m_cwd_m 0.00000 0.640253 0.640253
sigma_b_dist_h_cwd_m 0.00000 -0.534931 -0.534931
sigma_b_dist_m_cwd_m 0.00000 0.302092 0.302092
sigma_b_density_h_cwd_m 0.00000 -0.209857 -0.209857
sigma_b_density_m_cwd_m 0.00000 -0.701394 -0.701394
sigma_b_buck_h_cwd_m 0.00000 -0.341320 -0.341320
sigma_b_buck_m_cwd_m 0.00000 -0.491618 -0.491618
sigma_b_cwd_h_cwd_m 0.00000 0.493179 0.493179
sigma_b_cwd_m 0.13367 -0.077413 -0.211081
mu_log_b_fee -3.68017 -3.236465 0.443706
sigma_b_asc_3_fee 0.00000 0.300379 0.300379
sigma_b_asc_3_shift_Q4_lease_fee 0.00000 0.093884 0.093884
sigma_b_land_h_fee 0.00000 -0.555935 -0.555935
sigma_b_land_m_fee 0.00000 1.135949 1.135949
sigma_b_dist_h_fee 0.00000 0.137179 0.137179
sigma_b_dist_m_fee 0.00000 -0.247979 -0.247979
sigma_b_density_h_fee 0.00000 0.696202 0.696202
sigma_b_density_m_fee 0.00000 -0.149786 -0.149786
sigma_b_buck_h_fee 0.00000 0.030079 0.030079
sigma_b_buck_m_fee 0.00000 -0.586774 -0.586774
sigma_b_cwd_h_fee 0.00000 0.909040 0.909040
sigma_b_cwd_m_fee 0.00000 0.972526 0.972526
sigma_log_b_fee 2.78401 2.125332 -0.658682

Settings and functions used in model definition:

apollo_control
--------------
Value
modelName "MMNL_preference_space_correlated"
modelDescr "Mixed logit model on Swiss route choice data, correlated all normals except fee, Lognormals in utility space"
indivID "Serial1"
mixing "TRUE"
nCores "19"
outputDirectory "output/"
debug "FALSE"
workInLogs "FALSE"
seed "13"
HB "FALSE"
noValidation "FALSE"
noDiagnostics "FALSE"
calculateLLC "TRUE"
panelData "TRUE"
analyticGrad "TRUE"
analyticGrad_manualSet "FALSE"
overridePanel "FALSE"
preventOverridePanel "FALSE"
noModification "FALSE"

Hessian routines attempted
--------------------------
none


apollo_randCoeff
------------------
function(apollo_beta, apollo_inputs){
randcoeff = list()

randcoeff[["b_asc_3"]] = mu_b_asc_3 + sigma_b_asc_3 * draws_asc3
randcoeff[["b_asc_3_shift_Q4_lease"]] = mu_b_asc_3_shift_Q4_lease + sigma_b_asc_3_asc_3_shift_Q4_lease * draws_asc3 + sigma_b_asc_3_shift_Q4_lease * draws_lease
randcoeff[["b_land_h"]] = mu_b_land_h + sigma_b_asc_3_land_h * draws_asc3 + sigma_b_asc_3_shift_Q4_lease_land_h * draws_lease + sigma_b_land_h * draws_land_h
randcoeff[["b_land_m"]] = mu_b_land_m + sigma_b_asc_3_land_m * draws_asc3 + sigma_b_asc_3_shift_Q4_lease_land_m * draws_lease + sigma_b_land_h_land_m * draws_land_h + sigma_b_land_m * draws_land_m
randcoeff[["b_dist_h"]] = mu_b_dist_h + sigma_b_asc_3_dist_h * draws_asc3 + sigma_b_asc_3_shift_Q4_lease_dist_h * draws_lease + sigma_b_land_h_dist_h * draws_land_h + sigma_b_land_m_dist_h * draws_land_m + sigma_b_dist_h * draws_dist_h
randcoeff[["b_dist_m"]] = mu_b_dist_m + sigma_b_asc_3_dist_m * draws_asc3 + sigma_b_asc_3_shift_Q4_lease_dist_m * draws_lease + sigma_b_land_h_dist_m * draws_land_h + sigma_b_land_m_dist_m * draws_land_m + sigma_b_dist_h_dist_m * draws_dist_h + sigma_b_dist_m * draws_dist_m
randcoeff[["b_density_h"]] = mu_b_density_h + sigma_b_asc_3_density_h * draws_asc3 + sigma_b_asc_3_shift_Q4_lease_density_h * draws_lease + sigma_b_land_h_density_h * draws_land_h + sigma_b_land_m_density_h * draws_land_m + sigma_b_dist_h_density_h * draws_dist_h + sigma_b_dist_m_density_h * draws_dist_m + sigma_b_density_h * draws_density_h
randcoeff[["b_density_m"]] = mu_b_density_m + sigma_b_asc_3_density_m * draws_asc3 + sigma_b_asc_3_shift_Q4_lease_density_m * draws_lease + sigma_b_land_h_density_m * draws_land_h + sigma_b_land_m_density_m * draws_land_m + sigma_b_dist_h_density_m * draws_dist_h + sigma_b_dist_m_density_m * draws_dist_m + sigma_b_density_h_density_m * draws_density_h + sigma_b_density_m * draws_density_m
randcoeff[["b_buck_h"]] = mu_b_buck_h + sigma_b_asc_3_buck_h * draws_asc3 + sigma_b_asc_3_shift_Q4_lease_buck_h * draws_lease + sigma_b_land_h_buck_h * draws_land_h + sigma_b_land_m_buck_h * draws_land_m + sigma_b_dist_h_buck_h * draws_dist_h + sigma_b_dist_m_buck_h * draws_dist_m + sigma_b_density_h_buck_h * draws_density_h + sigma_b_density_m_buck_h * draws_density_m + sigma_b_buck_h * draws_buck_h
randcoeff[["b_buck_m"]] = mu_b_buck_m + sigma_b_asc_3_buck_m * draws_asc3 + sigma_b_asc_3_shift_Q4_lease_buck_m * draws_lease + sigma_b_land_h_buck_m * draws_land_h + sigma_b_land_m_buck_m * draws_land_m + sigma_b_dist_h_buck_m * draws_dist_h + sigma_b_dist_m_buck_m * draws_dist_m + sigma_b_density_h_buck_m * draws_density_h + sigma_b_density_m_buck_m * draws_density_m + sigma_b_buck_h_buck_m * draws_buck_h + sigma_b_buck_m * draws_buck_m
randcoeff[["b_cwd_h"]] = mu_b_cwd_h + sigma_b_asc_3_cwd_h * draws_asc3 + sigma_b_asc_3_shift_Q4_lease_cwd_h * draws_lease + sigma_b_land_h_cwd_h * draws_land_h + sigma_b_land_m_cwd_h * draws_land_m + sigma_b_dist_h_cwd_h * draws_dist_h + sigma_b_dist_m_cwd_h * draws_dist_m + sigma_b_density_h_cwd_h * draws_density_h + sigma_b_density_m_cwd_h * draws_density_m + sigma_b_buck_h_cwd_h * draws_buck_h + sigma_b_buck_m_cwd_h * draws_buck_m + sigma_b_cwd_h * draws_cwd_h
randcoeff[["b_cwd_m"]] = mu_b_cwd_m + sigma_b_asc_3_cwd_m * draws_asc3 + sigma_b_asc_3_shift_Q4_lease_cwd_m * draws_lease + sigma_b_land_h_cwd_m * draws_land_h + sigma_b_land_m_cwd_m * draws_land_m + sigma_b_dist_h_cwd_m * draws_dist_h + sigma_b_dist_m_cwd_m * draws_dist_m + sigma_b_density_h_cwd_m * draws_density_h + sigma_b_density_m_cwd_m * draws_density_m + sigma_b_buck_h_cwd_m * draws_buck_h + sigma_b_buck_m_cwd_m * draws_buck_m + sigma_b_cwd_h_cwd_m * draws_cwd_h + sigma_b_cwd_m * draws_cwd_m
randcoeff[["b_fee"]] = -exp( mu_log_b_fee + sigma_b_asc_3_fee * draws_asc3 + sigma_b_asc_3_shift_Q4_lease_fee * draws_lease + sigma_b_land_h_fee * draws_land_h + sigma_b_land_m_fee * draws_land_m + sigma_b_dist_h_fee * draws_dist_h + sigma_b_dist_m_fee * draws_dist_m + sigma_b_density_h_fee * draws_density_h + sigma_b_density_m_fee * draws_density_m + sigma_b_buck_h_fee * draws_buck_h + sigma_b_buck_m_fee * draws_buck_m + sigma_b_cwd_h_fee * draws_cwd_h + sigma_b_cwd_m_fee * draws_cwd_m + sigma_log_b_fee * draws_fee )

return(randcoeff)
}
<bytecode: 0x00000142f7ffb330>


apollo_probabilities
----------------------
function(apollo_beta, apollo_inputs, functionality="estimate"){

### Function initialisation: do not change the following three commands
### Attach inputs and detach after function exit
apollo_attach(apollo_beta, apollo_inputs)
on.exit(apollo_detach(apollo_beta, apollo_inputs))

### Create list of probabilities P
P = list()

### Create alternative specific constants and coefficients using interactions with socio-demographics (i added new line)
b_asc_3_value = b_asc_3 + b_asc_3_shift_Q4_lease * Q4_lease

### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
V = list()
V[["alt1"]] = b_land_h * land_h1 + b_land_m * land_m1 + b_dist_h * dist_h1 + b_dist_m * dist_m1 + b_density_h * density_h1 + b_density_m * density_m1 + b_buck_h * buck_h1+ b_buck_m * buck_m1 + b_cwd_h * cwd_h1 + b_cwd_m * cwd_m1 + b_fee * fee1
V[["alt2"]] = b_land_h * land_h2 + b_land_m * land_m2 + b_dist_h * dist_h2 + b_dist_m * dist_m2 + b_density_h * density_h2 + b_density_m * density_m2 + b_buck_h * buck_h2+ b_buck_m * buck_m2 + b_cwd_h * cwd_h2 + b_cwd_m * cwd_m2 + b_fee * fee2
V[["alt3"]] = b_asc_3_value + b_land_h * land_h3 + b_land_m * land_m3 + b_dist_h * dist_h3 + b_dist_m * dist_m3 + b_density_h * density_h3 + b_density_m * density_m3 + b_buck_h * buck_h3+ b_buck_m * buck_m3 + b_cwd_h * cwd_h3 + b_cwd_m * cwd_m3 + b_fee * fee3

### Define settings for MNL model component
mnl_settings = list(
alternatives = c(alt1=1, alt2=2, alt3=3),
avail = list(alt1=1, alt2=1, alt3=1),
choiceVar = choice_set,
utilities = V
)

### Compute probabilities using MNL model
P[["model"]] = apollo_mnl(mnl_settings, functionality)

### Take product across observation for same individual
P = apollo_panelProd(P, apollo_inputs, functionality)

### Average across inter-individual draws
P = apollo_avgInterDraws(P, apollo_inputs, functionality)

### Prepare and return outputs of function
P = apollo_prepareProb(P, apollo_inputs, functionality)
return(P)
}
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: Mixed logit model result

Post by stephanehess »

Hi

your model is quite possibly not empirically identified. You are trying to estimate a model with 13 random parameters and a full covariance matrix. To estimate this model reliably, you would need to use a much larger number of draws, and the fact that you're getting a failure in the calculation of the covariance matrix likely points to an identification issue.

Did you start with an MNL model, and then gradually build up complexity, adding the random parameters not all at once?

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
ramkumar
Posts: 5
Joined: 02 Jun 2023, 16:53

Re: Mixed logit model result

Post by ramkumar »

Dr. Hess,

Thank you so much for the response. I did not start with an MNL model and build on it. What I did, I started with MMNL model with uncorrelated parameters and then run the MMNL model with correlated parameters. I again tried to run the MMNL model with correlated parameters using 1,000 draws, got a result with the following warnings:

1: In append(newtodo, x) : restarting interrupted promise evaluation
2: In file(file, ifelse(append, "a", "w")) :
cannot open file 'output/MMNL_preference_space_correlated_intereations.csv': Permission denied

It took 33 hours to obtain the result (I have 16GB RAM computer with 20 cores).

I will try to follow your suggestions and let you know if any. My ultimate goal is to estimate WTP space model. One thing, I did not understand, can I estimate WTP space model using the MMNL uncorrelated parameters template that you provided in examples?
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: Mixed logit model result

Post by stephanehess »

Hi

every analysis should always start with a simple MNL model really.

The error message you get looks like a file access issue, unlikely related to Apollo

But for your model, you'll need to use many more than 1000 draws to get stable results so I suggest that if you really want to estimate this model on your data, you do it on a high performance machine.

Regarding WTP space, you can do this with either correlated or uncorrelated distributions. WTP space is just a different parameterisation

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
ramkumar
Posts: 5
Joined: 02 Jun 2023, 16:53

Re: Mixed logit model result

Post by ramkumar »

Thank you so much for the suggestions.

Ram
Post Reply