Model run by stephane.hess using Apollo 0.3.6 on R 4.5.1 for Darwin. Please acknowledge the use of Apollo by citing Hess & Palma (2019) DOI 10.1016/j.jocm.2019.100170 www.ApolloChoiceModelling.com Model name : EM_MMNL Model description : Mixed logit model on Swiss route choice data, correlated Lognormals in utility space, EM algorithm Model run at : 2025-09-19 14:51:21.883976 Estimation method : EM algorithm (bgw) -> Maximum likelihood (bgw) Estimation diagnosis : Relative function convergence Optimisation diagnosis : Maximum found hessian properties : Negative definite maximum eigenvalue : -5.799802 reciprocal of condition number : 0.000106781 Number of individuals : 388 Number of rows in database : 3492 Number of modelled outcomes : 3492 Number of cores used : 2 Number of inter-individual draws : 500 (halton) LL(start) : -2026.72 LL at equal shares, LL(0) : -2420.47 LL at observed shares, LL(C) : -2420.39 LL(final) : -1404.83 Rho-squared vs equal shares : 0.4196 Adj.Rho-squared vs equal shares : 0.4138 Rho-squared vs observed shares : 0.4196 Adj.Rho-squared vs observed shares : 0.4142 AIC : 2837.66 BIC : 2923.88 Estimated parameters : 14 Time taken (hh:mm:ss) : 00:02:52.38 pre-estimation : 00:00:33.02 estimation : 00:01:24.06 post-estimation : 00:00:55.29 Iterations : 92 (EM) & 33 (bgw) Unconstrained optimisation. Estimates: Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0) mu_log_b_tt -1.32145 0.14920 -8.857 0.14786 -8.937 mu_log_b_tc -0.43544 0.16092 -2.706 0.15265 -2.853 mu_log_b_hw -2.37080 0.15447 -15.348 0.14953 -15.855 mu_log_b_ch 1.22088 0.14857 8.218 0.14856 8.218 sigma_log_b_tt 1.42175 0.17620 8.069 0.17041 8.343 sigma_log_b_tt_tc 1.81356 0.17944 10.107 0.17137 10.583 sigma_log_b_tc 0.82650 0.03903 21.174 0.03082 26.821 sigma_log_b_tt_hw 0.97699 0.17986 5.432 0.17544 5.569 sigma_log_b_tc_hw 0.27258 0.04344 6.275 0.03257 8.370 sigma_log_b_hw 1.08693 0.05062 21.474 0.03649 29.789 sigma_log_b_tt_ch 1.17382 0.17899 6.558 0.17383 6.752 sigma_log_b_tc_ch 0.06296 0.03238 1.944 0.02271 2.772 sigma_log_b_hw_ch 0.40958 0.04020 10.188 0.02869 14.276 sigma_log_b_ch 0.72634 0.04820 15.068 0.03078 23.594 Overview of choices for MNL model component : alt1 alt2 Times available 3492.00 3492.00 Times chosen 1734.00 1758.00 Percentage chosen overall 49.66 50.34 Percentage chosen when available 49.66 50.34 Classical covariance matrix: mu_log_b_tt mu_log_b_tc mu_log_b_hw mu_log_b_ch mu_log_b_tt 0.02226 0.022049 0.018193 0.01964 mu_log_b_tc 0.02205 0.025896 0.018761 0.02019 mu_log_b_hw 0.01819 0.018761 0.023861 0.01864 mu_log_b_ch 0.01964 0.020186 0.018639 0.02207 sigma_log_b_tt 0.01578 0.015235 0.017633 0.01732 sigma_log_b_tt_tc 0.01583 0.013504 0.017135 0.01717 sigma_log_b_tc 1.3021e-04 -6.2182e-04 2.1753e-04 6.3319e-04 sigma_log_b_tt_hw 0.01725 0.015554 0.015932 0.01804 sigma_log_b_tc_hw 6.378e-06 -4.2248e-04 -0.001109 3.8751e-04 sigma_log_b_hw 4.8580e-04 0.001043 -8.5043e-04 3.9894e-04 sigma_log_b_tt_ch 0.01705 0.015637 0.017674 0.01723 sigma_log_b_tc_ch -3.0232e-04 -6.9650e-04 -3.5943e-04 5.140e-07 sigma_log_b_hw_ch 8.969e-06 3.1025e-04 6.4490e-04 -4.8811e-04 sigma_log_b_ch 2.273e-05 -1.3311e-04 -6.7332e-04 -3.5572e-04 sigma_log_b_tt sigma_log_b_tt_tc sigma_log_b_tc sigma_log_b_tt_hw mu_log_b_tt 0.01578 0.01583 1.3021e-04 0.017247 mu_log_b_tc 0.01524 0.01350 -6.2182e-04 0.015554 mu_log_b_hw 0.01763 0.01714 2.1753e-04 0.015932 mu_log_b_ch 0.01732 0.01717 6.3319e-04 0.018041 sigma_log_b_tt 0.03105 0.03112 -5.983e-05 0.029779 sigma_log_b_tt_tc 0.03112 0.03220 3.5368e-04 0.030700 sigma_log_b_tc -5.983e-05 3.5368e-04 0.001524 0.001511 sigma_log_b_tt_hw 0.02978 0.03070 0.001511 0.032349 sigma_log_b_tc_hw -7.8189e-04 -2.5311e-04 0.001119 8.4072e-04 sigma_log_b_hw 5.1287e-04 1.0276e-04 -9.1301e-04 -0.001104 sigma_log_b_tt_ch 0.03038 0.03105 0.001190 0.031252 sigma_log_b_tc_ch -5.7896e-04 -1.1758e-04 8.1230e-04 5.5828e-04 sigma_log_b_hw_ch 3.6674e-04 -5.232e-05 -7.7341e-04 -0.001107 sigma_log_b_ch -2.0093e-04 -1.3441e-04 -3.1265e-04 -5.7552e-04 sigma_log_b_tc_hw sigma_log_b_hw sigma_log_b_tt_ch sigma_log_b_tc_ch mu_log_b_tt 6.378e-06 4.8580e-04 0.017052 -3.0232e-04 mu_log_b_tc -4.2248e-04 0.001043 0.015637 -6.9650e-04 mu_log_b_hw -0.001109 -8.5043e-04 0.017674 -3.5943e-04 mu_log_b_ch 3.8751e-04 3.9894e-04 0.017235 5.140e-07 sigma_log_b_tt -7.8189e-04 5.1287e-04 0.030381 -5.7896e-04 sigma_log_b_tt_tc -2.5311e-04 1.0276e-04 0.031052 -1.1758e-04 sigma_log_b_tc 0.001119 -9.1301e-04 0.001190 8.1230e-04 sigma_log_b_tt_hw 8.4072e-04 -0.001104 0.031252 5.5828e-04 sigma_log_b_tc_hw 0.001887 -8.6177e-04 4.3011e-04 0.001009 sigma_log_b_hw -8.6177e-04 0.002562 -6.1453e-04 -8.4300e-04 sigma_log_b_tt_ch 4.3011e-04 -6.1453e-04 0.032038 2.2938e-04 sigma_log_b_tc_ch 0.001009 -8.4300e-04 2.2938e-04 0.001049 sigma_log_b_hw_ch -0.001128 0.001252 -5.3487e-04 -7.6396e-04 sigma_log_b_ch -3.4833e-04 4.9919e-04 -0.001101 -2.9286e-04 sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt 8.969e-06 2.273e-05 mu_log_b_tc 3.1025e-04 -1.3311e-04 mu_log_b_hw 6.4490e-04 -6.7332e-04 mu_log_b_ch -4.8811e-04 -3.5572e-04 sigma_log_b_tt 3.6674e-04 -2.0093e-04 sigma_log_b_tt_tc -5.232e-05 -1.3441e-04 sigma_log_b_tc -7.7341e-04 -3.1265e-04 sigma_log_b_tt_hw -0.001107 -5.7552e-04 sigma_log_b_tc_hw -0.001128 -3.4833e-04 sigma_log_b_hw 0.001252 4.9919e-04 sigma_log_b_tt_ch -5.3487e-04 -0.001101 sigma_log_b_tc_ch -7.6396e-04 -2.9286e-04 sigma_log_b_hw_ch 0.001616 -9.345e-05 sigma_log_b_ch -9.345e-05 0.002324 Robust covariance matrix: mu_log_b_tt mu_log_b_tc mu_log_b_hw mu_log_b_ch mu_log_b_tt 0.02186 0.020977 0.017879 0.01991 mu_log_b_tc 0.02098 0.023301 0.018349 0.02055 mu_log_b_hw 0.01788 0.018349 0.022360 0.01807 mu_log_b_ch 0.01991 0.020546 0.018071 0.02207 sigma_log_b_tt 0.01578 0.015757 0.017063 0.01681 sigma_log_b_tt_tc 0.01611 0.014651 0.016576 0.01662 sigma_log_b_tc 5.8234e-04 -3.0333e-04 7.764e-05 6.6224e-04 sigma_log_b_tt_hw 0.01751 0.015845 0.015378 0.01782 sigma_log_b_tc_hw 3.6942e-04 -3.3888e-04 -0.001071 5.2016e-04 sigma_log_b_hw 3.8881e-04 0.001274 -2.9424e-04 4.7412e-04 sigma_log_b_tt_ch 0.01703 0.015659 0.016941 0.01675 sigma_log_b_tc_ch -4.635e-05 -6.5635e-04 -4.8096e-04 2.349e-05 sigma_log_b_hw_ch -8.360e-05 4.3116e-04 8.3725e-04 -4.4186e-04 sigma_log_b_ch 6.656e-06 -5.075e-05 -5.1553e-04 -2.6473e-04 sigma_log_b_tt sigma_log_b_tt_tc sigma_log_b_tc sigma_log_b_tt_hw mu_log_b_tt 0.01578 0.01611 5.8234e-04 0.017506 mu_log_b_tc 0.01576 0.01465 -3.0333e-04 0.015845 mu_log_b_hw 0.01706 0.01658 7.764e-05 0.015378 mu_log_b_ch 0.01681 0.01662 6.6224e-04 0.017823 sigma_log_b_tt 0.02904 0.02885 2.2560e-04 0.028316 sigma_log_b_tt_tc 0.02885 0.02937 7.6034e-04 0.029128 sigma_log_b_tc 2.2560e-04 7.6034e-04 9.4962e-04 0.001653 sigma_log_b_tt_hw 0.02832 0.02913 0.001653 0.030778 sigma_log_b_tc_hw -5.9668e-04 -8.332e-05 8.9036e-04 0.001090 sigma_log_b_hw 4.4926e-04 -3.514e-05 -8.4440e-04 -6.9954e-04 sigma_log_b_tt_ch 0.02883 0.02935 0.001199 0.029972 sigma_log_b_tc_ch -4.9293e-04 -8.797e-05 6.4774e-04 5.6682e-04 sigma_log_b_hw_ch 4.8598e-04 1.0506e-04 -7.0004e-04 -8.2788e-04 sigma_log_b_ch -4.6921e-04 -4.5218e-04 -1.9219e-04 -7.0502e-04 sigma_log_b_tc_hw sigma_log_b_hw sigma_log_b_tt_ch sigma_log_b_tc_ch mu_log_b_tt 3.6942e-04 3.8881e-04 0.017027 -4.635e-05 mu_log_b_tc -3.3888e-04 0.001274 0.015659 -6.5635e-04 mu_log_b_hw -0.001071 -2.9424e-04 0.016941 -4.8096e-04 mu_log_b_ch 5.2016e-04 4.7412e-04 0.016753 2.349e-05 sigma_log_b_tt -5.9668e-04 4.4926e-04 0.028828 -4.9293e-04 sigma_log_b_tt_tc -8.332e-05 -3.514e-05 0.029352 -8.797e-05 sigma_log_b_tc 8.9036e-04 -8.4440e-04 0.001199 6.4774e-04 sigma_log_b_tt_hw 0.001090 -6.9954e-04 0.029972 5.6682e-04 sigma_log_b_tc_hw 0.001061 -6.7964e-04 3.5757e-04 6.7359e-04 sigma_log_b_hw -6.7964e-04 0.001331 -5.5522e-04 -6.1892e-04 sigma_log_b_tt_ch 3.5757e-04 -5.5522e-04 0.030218 2.0109e-04 sigma_log_b_tc_ch 6.7359e-04 -6.1892e-04 2.0109e-04 5.1592e-04 sigma_log_b_hw_ch -8.2295e-04 6.8953e-04 -1.8139e-04 -5.2261e-04 sigma_log_b_ch -1.7296e-04 4.0038e-04 -8.5744e-04 -1.7516e-04 sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt -8.360e-05 6.656e-06 mu_log_b_tc 4.3116e-04 -5.075e-05 mu_log_b_hw 8.3725e-04 -5.1553e-04 mu_log_b_ch -4.4186e-04 -2.6473e-04 sigma_log_b_tt 4.8598e-04 -4.6921e-04 sigma_log_b_tt_tc 1.0506e-04 -4.5218e-04 sigma_log_b_tc -7.0004e-04 -1.9219e-04 sigma_log_b_tt_hw -8.2788e-04 -7.0502e-04 sigma_log_b_tc_hw -8.2295e-04 -1.7296e-04 sigma_log_b_hw 6.8953e-04 4.0038e-04 sigma_log_b_tt_ch -1.8139e-04 -8.5744e-04 sigma_log_b_tc_ch -5.2261e-04 -1.7516e-04 sigma_log_b_hw_ch 8.2316e-04 2.798e-05 sigma_log_b_ch 2.798e-05 9.4771e-04 Classical correlation matrix: mu_log_b_tt mu_log_b_tc mu_log_b_hw mu_log_b_ch mu_log_b_tt 1.000000 0.91830 0.78938 0.88596 mu_log_b_tc 0.918303 1.00000 0.75475 0.84433 mu_log_b_hw 0.789383 0.75475 1.00000 0.81219 mu_log_b_ch 0.885956 0.84433 0.81219 1.00000 sigma_log_b_tt 0.600414 0.53732 0.64787 0.66156 sigma_log_b_tt_tc 0.591366 0.46764 0.61819 0.64407 sigma_log_b_tc 0.022357 -0.09900 0.03608 0.10919 sigma_log_b_tt_hw 0.642683 0.53738 0.57347 0.67516 sigma_log_b_tc_hw 9.8406e-04 -0.06043 -0.16520 0.06004 sigma_log_b_hw 0.064325 0.12801 -0.10877 0.05305 sigma_log_b_tt_ch 0.638493 0.54288 0.63925 0.64812 sigma_log_b_tc_ch -0.062569 -0.13365 -0.07185 1.0684e-04 sigma_log_b_hw_ch 0.001495 0.04796 0.10385 -0.08173 sigma_log_b_ch 0.003160 -0.01716 -0.09043 -0.04967 sigma_log_b_tt sigma_log_b_tt_tc sigma_log_b_tc sigma_log_b_tt_hw mu_log_b_tt 0.600414 0.591366 0.022357 0.64268 mu_log_b_tc 0.537321 0.467637 -0.098995 0.53738 mu_log_b_hw 0.647871 0.618191 0.036078 0.57347 mu_log_b_ch 0.661560 0.644069 0.109189 0.67516 sigma_log_b_tt 1.000000 0.984379 -0.008699 0.93967 sigma_log_b_tt_tc 0.984379 1.000000 0.050495 0.95120 sigma_log_b_tc -0.008699 0.050495 1.000000 0.21524 sigma_log_b_tt_hw 0.939671 0.951198 0.215243 1.00000 sigma_log_b_tc_hw -0.102151 -0.032470 0.659969 0.10760 sigma_log_b_hw 0.057506 0.011313 -0.462107 -0.12132 sigma_log_b_tt_ch 0.963295 0.966766 0.170377 0.97076 sigma_log_b_tc_ch -0.101466 -0.020234 0.642622 0.09585 sigma_log_b_hw_ch 0.051775 -0.007253 -0.492875 -0.15313 sigma_log_b_ch -0.023658 -0.015539 -0.166171 -0.06638 sigma_log_b_tc_hw sigma_log_b_hw sigma_log_b_tt_ch sigma_log_b_tc_ch mu_log_b_tt 9.8406e-04 0.06433 0.63849 -0.06257 mu_log_b_tc -0.06043 0.12801 0.54288 -0.13365 mu_log_b_hw -0.16520 -0.10877 0.63925 -0.07185 mu_log_b_ch 0.06004 0.05305 0.64812 1.0684e-04 sigma_log_b_tt -0.10215 0.05751 0.96330 -0.10147 sigma_log_b_tt_tc -0.03247 0.01131 0.96677 -0.02023 sigma_log_b_tc 0.65997 -0.46211 0.17038 0.64262 sigma_log_b_tt_hw 0.10760 -0.12132 0.97076 0.09585 sigma_log_b_tc_hw 1.00000 -0.39192 0.05532 0.71713 sigma_log_b_hw -0.39192 1.00000 -0.06783 -0.51429 sigma_log_b_tt_ch 0.05532 -0.06783 1.00000 0.03957 sigma_log_b_tc_ch 0.71713 -0.51429 0.03957 1.00000 sigma_log_b_hw_ch -0.64611 0.61534 -0.07433 -0.58682 sigma_log_b_ch -0.16635 0.20459 -0.12756 -0.18761 sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt 0.001495 0.003160 mu_log_b_tc 0.047958 -0.017160 mu_log_b_hw 0.103852 -0.090428 mu_log_b_ch -0.081726 -0.049672 sigma_log_b_tt 0.051775 -0.023658 sigma_log_b_tt_tc -0.007253 -0.015539 sigma_log_b_tc -0.492875 -0.166171 sigma_log_b_tt_hw -0.153129 -0.066383 sigma_log_b_tc_hw -0.646113 -0.166347 sigma_log_b_hw 0.615342 0.204595 sigma_log_b_tt_ch -0.074332 -0.127563 sigma_log_b_tc_ch -0.586825 -0.187612 sigma_log_b_hw_ch 1.000000 -0.048223 sigma_log_b_ch -0.048223 1.000000 Robust correlation matrix: mu_log_b_tt mu_log_b_tc mu_log_b_hw mu_log_b_ch mu_log_b_tt 1.000000 0.92939 0.80862 0.906456 mu_log_b_tc 0.929390 1.00000 0.80387 0.906032 mu_log_b_hw 0.808623 0.80387 1.00000 0.813459 mu_log_b_ch 0.906456 0.90603 0.81346 1.000000 sigma_log_b_tt 0.626178 0.60577 0.66962 0.664148 sigma_log_b_tt_tc 0.635884 0.56006 0.64685 0.652783 sigma_log_b_tc 0.127804 -0.06448 0.01685 0.144657 sigma_log_b_tt_hw 0.674842 0.59167 0.58620 0.683846 sigma_log_b_tc_hw 0.076717 -0.06817 -0.21988 0.107514 sigma_log_b_hw 0.072067 0.22867 -0.05393 0.087466 sigma_log_b_tt_ch 0.662419 0.59011 0.65172 0.648696 sigma_log_b_tc_ch -0.013802 -0.18930 -0.14161 0.006961 sigma_log_b_hw_ch -0.019705 0.09845 0.19515 -0.103668 sigma_log_b_ch 0.001462 -0.01080 -0.11199 -0.057884 sigma_log_b_tt sigma_log_b_tt_tc sigma_log_b_tc sigma_log_b_tt_hw mu_log_b_tt 0.62618 0.635884 0.12780 0.6748 mu_log_b_tc 0.60577 0.560061 -0.06448 0.5917 mu_log_b_hw 0.66962 0.646854 0.01685 0.5862 mu_log_b_ch 0.66415 0.652783 0.14466 0.6838 sigma_log_b_tt 1.00000 0.987904 0.04296 0.9472 sigma_log_b_tt_tc 0.98790 1.000000 0.14398 0.9689 sigma_log_b_tc 0.04296 0.143981 1.00000 0.3058 sigma_log_b_tt_hw 0.94717 0.968869 0.30583 1.0000 sigma_log_b_tc_hw -0.10752 -0.014930 0.88721 0.1907 sigma_log_b_hw 0.07226 -0.005620 -0.75099 -0.1093 sigma_log_b_tt_ch 0.97319 0.985293 0.22380 0.9828 sigma_log_b_tc_ch -0.12735 -0.022601 0.92542 0.1422 sigma_log_b_hw_ch 0.09940 0.021368 -0.79178 -0.1645 sigma_log_b_ch -0.08944 -0.085712 -0.20259 -0.1305 sigma_log_b_tc_hw sigma_log_b_hw sigma_log_b_tt_ch sigma_log_b_tc_ch mu_log_b_tt 0.07672 0.072067 0.66242 -0.013802 mu_log_b_tc -0.06817 0.228667 0.59011 -0.189302 mu_log_b_hw -0.21988 -0.053928 0.65172 -0.141606 mu_log_b_ch 0.10751 0.087466 0.64870 0.006961 sigma_log_b_tt -0.10752 0.072255 0.97319 -0.127353 sigma_log_b_tt_tc -0.01493 -0.005620 0.98529 -0.022601 sigma_log_b_tc 0.88721 -0.750989 0.22380 0.925422 sigma_log_b_tt_hw 0.19075 -0.109282 0.98278 0.142244 sigma_log_b_tc_hw 1.00000 -0.571962 0.06316 0.910627 sigma_log_b_hw -0.57196 1.000000 -0.08754 -0.746792 sigma_log_b_tt_ch 0.06316 -0.087535 1.00000 0.050930 sigma_log_b_tc_ch 0.91063 -0.746792 0.05093 1.000000 sigma_log_b_hw_ch -0.88077 0.658673 -0.03637 -0.801950 sigma_log_b_ch -0.17252 0.356444 -0.16023 -0.250502 sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt -0.01971 0.001462 mu_log_b_tc 0.09845 -0.010800 mu_log_b_hw 0.19515 -0.111989 mu_log_b_ch -0.10367 -0.057884 sigma_log_b_tt 0.09940 -0.089443 sigma_log_b_tt_tc 0.02137 -0.085712 sigma_log_b_tc -0.79178 -0.202590 sigma_log_b_tt_hw -0.16448 -0.130540 sigma_log_b_tc_hw -0.88077 -0.172524 sigma_log_b_hw 0.65867 0.356444 sigma_log_b_tt_ch -0.03637 -0.160226 sigma_log_b_tc_ch -0.80195 -0.250502 sigma_log_b_hw_ch 1.00000 0.031682 sigma_log_b_ch 0.03168 1.000000 20 most extreme outliers in terms of lowest average per choice prediction: ID Avg prob per choice 23205 0.3459662 15174 0.3531498 22580 0.3559997 16178 0.3603625 16617 0.3606482 76862 0.3770558 16489 0.3817047 21623 0.3887258 21922 0.3893615 15056 0.3897160 22820 0.3983983 22961 0.3999886 16184 0.4004158 20100 0.4041702 17187 0.4070772 17645 0.4136416 15312 0.4147209 12534 0.4175718 24627 0.4218412 14802 0.4246985 Settings and functions used in model definition: apollo_control -------------- Value modelDescr "Mixed logit model on Swiss route choice data, correlated Lognormals in utility space, EM algorithm" indivID "ID" nCores "2" outputDirectory "output/" mixing "TRUE" debug "FALSE" modelName "EM_MMNL" workInLogs "FALSE" seed "13" HB "FALSE" noValidation "TRUE" noDiagnostics "TRUE" calculateLLC "TRUE" analyticHessian "FALSE" memorySaver "FALSE" panelData "TRUE" analyticGrad "TRUE" analyticGrad_manualSet "FALSE" overridePanel "FALSE" preventOverridePanel "FALSE" noModification "FALSE" Hessian routines attempted -------------------------- numerical jacobian of LL analytical gradient Scaling used in computing Hessian --------------------------------- Value mu_log_b_tt 1.32145337 mu_log_b_tc 0.43543849 mu_log_b_hw 2.37079989 mu_log_b_ch 1.22088016 sigma_log_b_tt 1.42174774 sigma_log_b_tt_tc 1.81356082 sigma_log_b_tc 0.82650225 sigma_log_b_tt_hw 0.97698934 sigma_log_b_tc_hw 0.27257944 sigma_log_b_hw 1.08693277 sigma_log_b_tt_ch 1.17381557 sigma_log_b_tc_ch 0.06296354 sigma_log_b_hw_ch 0.40957684 sigma_log_b_ch 0.72634409 apollo_randCoeff ------------------ function(apollo_beta, apollo_inputs){ randcoeff = list() randcoeff[["b_tt"]] = -exp( mu_log_b_tt + sigma_log_b_tt * draws_tt ) randcoeff[["b_tc"]] = -exp( mu_log_b_tc + sigma_log_b_tt_tc * draws_tt + sigma_log_b_tc * draws_tc ) randcoeff[["b_hw"]] = -exp( mu_log_b_hw + sigma_log_b_tt_hw * draws_tt + sigma_log_b_tc_hw * draws_tc + sigma_log_b_hw * draws_hw ) randcoeff[["b_ch"]] = -exp( mu_log_b_ch + sigma_log_b_tt_ch * draws_tt + sigma_log_b_tc_ch * draws_tc + sigma_log_b_hw_ch * draws_hw + sigma_log_b_ch * draws_ch ) return(randcoeff) } 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() ### List of utilities: these must use the same names as in mnl_settings, order is irrelevant V = list() V[["alt1"]] = b_tt * tt1 + b_tc * tc1 + b_hw * hw1 + b_ch * ch1 V[["alt2"]] = b_tt * tt2 + b_tc * tc2 + b_hw * hw2 + b_ch * ch2 ### Define settings for MNL model component mnl_settings = list( alternatives = c(alt1=1, alt2=2), avail = list(alt1=1, alt2=1), choiceVar = choice, 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) }