Model run by stephane.hess using Apollo 0.3.5 on R 4.4.0 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-03-10 21:18:26.894127 Estimation method : EM algorithm (bgw) -> Maximum likelihood (bgw) Model 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:46.9 pre-estimation : 00:00:27.59 estimation : 00:01:24.82 post-estimation : 00:00:54.5 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.14805 -8.925 mu_log_b_tc -0.43544 0.16092 -2.706 0.15284 -2.849 mu_log_b_hw -2.37080 0.15447 -15.348 0.14973 -15.834 mu_log_b_ch 1.22088 0.14857 8.218 0.14875 8.207 sigma_log_b_tt 1.42175 0.17620 8.069 0.17063 8.332 sigma_log_b_tt_tc 1.81356 0.17944 10.107 0.17159 10.569 sigma_log_b_tc 0.82650 0.03903 21.174 0.03086 26.786 sigma_log_b_tt_hw 0.97699 0.17986 5.432 0.17566 5.562 sigma_log_b_tc_hw 0.27258 0.04344 6.275 0.03261 8.359 sigma_log_b_hw 1.08693 0.05062 21.474 0.03653 29.751 sigma_log_b_tt_ch 1.17382 0.17899 6.558 0.17406 6.744 sigma_log_b_tc_ch 0.06296 0.03238 1.944 0.02274 2.768 sigma_log_b_hw_ch 0.40958 0.04020 10.188 0.02873 14.257 sigma_log_b_ch 0.72634 0.04820 15.068 0.03082 23.564 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 sigma_log_b_tt sigma_log_b_tt_tc mu_log_b_tt 0.02226 0.022049 0.018193 0.01964 0.01578 0.01583 mu_log_b_tc 0.02205 0.025896 0.018761 0.02019 0.01524 0.01350 mu_log_b_hw 0.01819 0.018761 0.023861 0.01864 0.01763 0.01714 mu_log_b_ch 0.01964 0.020186 0.018639 0.02207 0.01732 0.01717 sigma_log_b_tt 0.01578 0.015235 0.017633 0.01732 0.03105 0.03112 sigma_log_b_tt_tc 0.01583 0.013504 0.017135 0.01717 0.03112 0.03220 sigma_log_b_tc 1.3021e-04 -6.2182e-04 2.1753e-04 6.3319e-04 -5.983e-05 3.5369e-04 sigma_log_b_tt_hw 0.01725 0.015554 0.015932 0.01804 0.02978 0.03070 sigma_log_b_tc_hw 6.379e-06 -4.2247e-04 -0.001109 3.8751e-04 -7.8188e-04 -2.5311e-04 sigma_log_b_hw 4.8580e-04 0.001043 -8.5044e-04 3.9894e-04 5.1287e-04 1.0276e-04 sigma_log_b_tt_ch 0.01705 0.015637 0.017674 0.01723 0.03038 0.03105 sigma_log_b_tc_ch -3.0232e-04 -6.9650e-04 -3.5943e-04 5.143e-07 -5.7896e-04 -1.1758e-04 sigma_log_b_hw_ch 8.969e-06 3.1025e-04 6.4490e-04 -4.8811e-04 3.6674e-04 -5.232e-05 sigma_log_b_ch 2.273e-05 -1.3311e-04 -6.7332e-04 -3.5572e-04 -2.0093e-04 -1.3441e-04 sigma_log_b_tc sigma_log_b_tt_hw sigma_log_b_tc_hw sigma_log_b_hw sigma_log_b_tt_ch sigma_log_b_tc_ch mu_log_b_tt 1.3021e-04 0.017247 6.379e-06 4.8580e-04 0.017052 -3.0232e-04 mu_log_b_tc -6.2182e-04 0.015554 -4.2247e-04 0.001043 0.015637 -6.9650e-04 mu_log_b_hw 2.1753e-04 0.015932 -0.001109 -8.5044e-04 0.017674 -3.5943e-04 mu_log_b_ch 6.3319e-04 0.018041 3.8751e-04 3.9894e-04 0.017235 5.143e-07 sigma_log_b_tt -5.983e-05 0.029779 -7.8188e-04 5.1287e-04 0.030381 -5.7896e-04 sigma_log_b_tt_tc 3.5369e-04 0.030700 -2.5311e-04 1.0276e-04 0.031052 -1.1758e-04 sigma_log_b_tc 0.001524 0.001511 0.001119 -9.1301e-04 0.001190 8.1230e-04 sigma_log_b_tt_hw 0.001511 0.032349 8.4072e-04 -0.001104 0.031252 5.5828e-04 sigma_log_b_tc_hw 0.001119 8.4072e-04 0.001887 -8.6177e-04 4.3011e-04 0.001009 sigma_log_b_hw -9.1301e-04 -0.001104 -8.6177e-04 0.002562 -6.1453e-04 -8.4300e-04 sigma_log_b_tt_ch 0.001190 0.031252 4.3011e-04 -6.1453e-04 0.032038 2.2938e-04 sigma_log_b_tc_ch 8.1230e-04 5.5828e-04 0.001009 -8.4300e-04 2.2938e-04 0.001049 sigma_log_b_hw_ch -7.7341e-04 -0.001107 -0.001128 0.001252 -5.3487e-04 -7.6396e-04 sigma_log_b_ch -3.1265e-04 -5.7552e-04 -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 sigma_log_b_tt sigma_log_b_tt_tc mu_log_b_tt 0.02192 0.021032 0.017925 0.01996 0.01582 0.01615 mu_log_b_tc 0.02103 0.023361 0.018396 0.02060 0.01580 0.01469 mu_log_b_hw 0.01793 0.018396 0.022418 0.01812 0.01711 0.01662 mu_log_b_ch 0.01996 0.020600 0.018117 0.02213 0.01686 0.01666 sigma_log_b_tt 0.01582 0.015798 0.017107 0.01686 0.02911 0.02892 sigma_log_b_tt_tc 0.01615 0.014688 0.016619 0.01666 0.02892 0.02944 sigma_log_b_tc 5.8385e-04 -3.0411e-04 7.784e-05 6.6395e-04 2.2618e-04 7.6231e-04 sigma_log_b_tt_hw 0.01755 0.015886 0.015418 0.01787 0.02839 0.02920 sigma_log_b_tc_hw 3.7038e-04 -3.3975e-04 -0.001074 5.2151e-04 -5.9822e-04 -8.354e-05 sigma_log_b_hw 3.8982e-04 0.001277 -2.9500e-04 4.7534e-04 4.5042e-04 -3.523e-05 sigma_log_b_tt_ch 0.01707 0.015699 0.016985 0.01680 0.02890 0.02943 sigma_log_b_tc_ch -4.647e-05 -6.5804e-04 -4.8220e-04 2.355e-05 -4.9420e-04 -8.820e-05 sigma_log_b_hw_ch -8.381e-05 4.3228e-04 8.3941e-04 -4.4301e-04 4.8723e-04 1.0533e-04 sigma_log_b_ch 6.673e-06 -5.088e-05 -5.1686e-04 -2.6541e-04 -4.7042e-04 -4.5334e-04 sigma_log_b_tc sigma_log_b_tt_hw sigma_log_b_tc_hw sigma_log_b_hw sigma_log_b_tt_ch sigma_log_b_tc_ch mu_log_b_tt 5.8385e-04 0.017551 3.7038e-04 3.8982e-04 0.017071 -4.647e-05 mu_log_b_tc -3.0411e-04 0.015886 -3.3975e-04 0.001277 0.015699 -6.5804e-04 mu_log_b_hw 7.784e-05 0.015418 -0.001074 -2.9500e-04 0.016985 -4.8220e-04 mu_log_b_ch 6.6395e-04 0.017869 5.2151e-04 4.7534e-04 0.016796 2.355e-05 sigma_log_b_tt 2.2618e-04 0.028389 -5.9822e-04 4.5042e-04 0.028903 -4.9420e-04 sigma_log_b_tt_tc 7.6231e-04 0.029204 -8.354e-05 -3.523e-05 0.029427 -8.820e-05 sigma_log_b_tc 9.5207e-04 0.001658 8.9266e-04 -8.4659e-04 0.001202 6.4942e-04 sigma_log_b_tt_hw 0.001658 0.030857 0.001093 -7.0135e-04 0.030049 5.6828e-04 sigma_log_b_tc_hw 8.9266e-04 0.001093 0.001063 -6.8140e-04 3.5850e-04 6.7533e-04 sigma_log_b_hw -8.4659e-04 -7.0135e-04 -6.8140e-04 0.001335 -5.5665e-04 -6.2052e-04 sigma_log_b_tt_ch 0.001202 0.030049 3.5850e-04 -5.5665e-04 0.030296 2.0162e-04 sigma_log_b_tc_ch 6.4942e-04 5.6828e-04 6.7533e-04 -6.2052e-04 2.0162e-04 5.1725e-04 sigma_log_b_hw_ch -7.0185e-04 -8.3002e-04 -8.2508e-04 6.9131e-04 -1.8186e-04 -5.2396e-04 sigma_log_b_ch -1.9269e-04 -7.0684e-04 -1.7341e-04 4.0141e-04 -8.5966e-04 -1.7561e-04 sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt -8.381e-05 6.673e-06 mu_log_b_tc 4.3228e-04 -5.088e-05 mu_log_b_hw 8.3941e-04 -5.1686e-04 mu_log_b_ch -4.4301e-04 -2.6541e-04 sigma_log_b_tt 4.8723e-04 -4.7042e-04 sigma_log_b_tt_tc 1.0533e-04 -4.5334e-04 sigma_log_b_tc -7.0185e-04 -1.9269e-04 sigma_log_b_tt_hw -8.3002e-04 -7.0684e-04 sigma_log_b_tc_hw -8.2508e-04 -1.7341e-04 sigma_log_b_hw 6.9131e-04 4.0141e-04 sigma_log_b_tt_ch -1.8186e-04 -8.5966e-04 sigma_log_b_tc_ch -5.2396e-04 -1.7561e-04 sigma_log_b_hw_ch 8.2529e-04 2.806e-05 sigma_log_b_ch 2.806e-05 9.5015e-04 Classical correlation matrix: mu_log_b_tt mu_log_b_tc mu_log_b_hw mu_log_b_ch sigma_log_b_tt sigma_log_b_tt_tc mu_log_b_tt 1.000000 0.91830 0.78938 0.88596 0.600414 0.591366 mu_log_b_tc 0.918303 1.00000 0.75475 0.84433 0.537321 0.467637 mu_log_b_hw 0.789383 0.75475 1.00000 0.81219 0.647871 0.618191 mu_log_b_ch 0.885956 0.84433 0.81219 1.00000 0.661560 0.644069 sigma_log_b_tt 0.600414 0.53732 0.64787 0.66156 1.000000 0.984379 sigma_log_b_tt_tc 0.591366 0.46764 0.61819 0.64407 0.984379 1.000000 sigma_log_b_tc 0.022357 -0.09900 0.03608 0.10919 -0.008699 0.050495 sigma_log_b_tt_hw 0.642683 0.53738 0.57347 0.67516 0.939671 0.951198 sigma_log_b_tc_hw 9.8417e-04 -0.06043 -0.16520 0.06004 -0.102151 -0.032470 sigma_log_b_hw 0.064325 0.12801 -0.10877 0.05305 0.057506 0.011313 sigma_log_b_tt_ch 0.638493 0.54288 0.63925 0.64812 0.963295 0.966766 sigma_log_b_tc_ch -0.062569 -0.13365 -0.07185 1.0691e-04 -0.101466 -0.020235 sigma_log_b_hw_ch 0.001495 0.04796 0.10385 -0.08173 0.051775 -0.007253 sigma_log_b_ch 0.003160 -0.01716 -0.09043 -0.04967 -0.023658 -0.015539 sigma_log_b_tc sigma_log_b_tt_hw sigma_log_b_tc_hw sigma_log_b_hw sigma_log_b_tt_ch sigma_log_b_tc_ch mu_log_b_tt 0.022357 0.64268 9.8417e-04 0.06433 0.63849 -0.06257 mu_log_b_tc -0.098995 0.53738 -0.06043 0.12801 0.54288 -0.13365 mu_log_b_hw 0.036078 0.57347 -0.16520 -0.10877 0.63925 -0.07185 mu_log_b_ch 0.109189 0.67516 0.06004 0.05305 0.64812 1.0691e-04 sigma_log_b_tt -0.008699 0.93967 -0.10215 0.05751 0.96330 -0.10147 sigma_log_b_tt_tc 0.050495 0.95120 -0.03247 0.01131 0.96677 -0.02023 sigma_log_b_tc 1.000000 0.21524 0.65997 -0.46211 0.17038 0.64262 sigma_log_b_tt_hw 0.215243 1.00000 0.10760 -0.12132 0.97076 0.09585 sigma_log_b_tc_hw 0.659969 0.10760 1.00000 -0.39192 0.05532 0.71713 sigma_log_b_hw -0.462107 -0.12132 -0.39192 1.00000 -0.06783 -0.51429 sigma_log_b_tt_ch 0.170377 0.97076 0.05532 -0.06783 1.00000 0.03957 sigma_log_b_tc_ch 0.642622 0.09585 0.71713 -0.51429 0.03957 1.00000 sigma_log_b_hw_ch -0.492876 -0.15313 -0.64611 0.61534 -0.07433 -0.58682 sigma_log_b_ch -0.166171 -0.06638 -0.16635 0.20460 -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.492876 -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.586824 -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 sigma_log_b_tt sigma_log_b_tt_tc mu_log_b_tt 1.000000 0.92939 0.80862 0.906456 0.62618 0.635884 mu_log_b_tc 0.929390 1.00000 0.80387 0.906032 0.60577 0.560061 mu_log_b_hw 0.808623 0.80387 1.00000 0.813459 0.66962 0.646854 mu_log_b_ch 0.906456 0.90603 0.81346 1.000000 0.66415 0.652783 sigma_log_b_tt 0.626178 0.60577 0.66962 0.664148 1.00000 0.987904 sigma_log_b_tt_tc 0.635884 0.56006 0.64685 0.652783 0.98790 1.000000 sigma_log_b_tc 0.127804 -0.06448 0.01685 0.144657 0.04296 0.143981 sigma_log_b_tt_hw 0.674842 0.59167 0.58620 0.683846 0.94717 0.968869 sigma_log_b_tc_hw 0.076718 -0.06817 -0.21988 0.107514 -0.10752 -0.014930 sigma_log_b_hw 0.072067 0.22867 -0.05393 0.087466 0.07226 -0.005620 sigma_log_b_tt_ch 0.662419 0.59011 0.65172 0.648696 0.97319 0.985293 sigma_log_b_tc_ch -0.013802 -0.18930 -0.14161 0.006961 -0.12735 -0.022601 sigma_log_b_hw_ch -0.019706 0.09845 0.19515 -0.103668 0.09940 0.021368 sigma_log_b_ch 0.001462 -0.01080 -0.11199 -0.057883 -0.08944 -0.085711 sigma_log_b_tc sigma_log_b_tt_hw sigma_log_b_tc_hw sigma_log_b_hw sigma_log_b_tt_ch sigma_log_b_tc_ch mu_log_b_tt 0.12780 0.6748 0.07672 0.072067 0.66242 -0.013802 mu_log_b_tc -0.06448 0.5917 -0.06817 0.228667 0.59011 -0.189302 mu_log_b_hw 0.01685 0.5862 -0.21988 -0.053929 0.65172 -0.141606 mu_log_b_ch 0.14466 0.6838 0.10751 0.087466 0.64870 0.006961 sigma_log_b_tt 0.04296 0.9472 -0.10752 0.072255 0.97319 -0.127352 sigma_log_b_tt_tc 0.14398 0.9689 -0.01493 -0.005620 0.98529 -0.022601 sigma_log_b_tc 1.00000 0.3058 0.88721 -0.750989 0.22380 0.925423 sigma_log_b_tt_hw 0.30583 1.0000 0.19075 -0.109283 0.98278 0.142245 sigma_log_b_tc_hw 0.88721 0.1907 1.00000 -0.571962 0.06316 0.910627 sigma_log_b_hw -0.75099 -0.1093 -0.57196 1.000000 -0.08754 -0.746793 sigma_log_b_tt_ch 0.22380 0.9828 0.06316 -0.087536 1.00000 0.050931 sigma_log_b_tc_ch 0.92542 0.1422 0.91063 -0.746793 0.05093 1.000000 sigma_log_b_hw_ch -0.79178 -0.1645 -0.88077 0.658673 -0.03637 -0.801949 sigma_log_b_ch -0.20259 -0.1305 -0.17253 0.356444 -0.16023 -0.250503 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.057883 sigma_log_b_tt 0.09940 -0.089443 sigma_log_b_tt_tc 0.02137 -0.085711 sigma_log_b_tc -0.79178 -0.202591 sigma_log_b_tt_hw -0.16448 -0.130540 sigma_log_b_tc_hw -0.88077 -0.172525 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.250503 sigma_log_b_hw_ch 1.00000 0.031683 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 Changes in parameter estimates from starting values: Initial Estimate Difference mu_log_b_tt -1.61530 -1.32145 0.293842 mu_log_b_tc -0.70214 -0.43544 0.266700 mu_log_b_hw -2.62598 -2.37080 0.255182 mu_log_b_ch 0.91590 1.22088 0.304978 sigma_log_b_tt 1.05987 1.42175 0.361874 sigma_log_b_tt_tc 1.43539 1.81356 0.378169 sigma_log_b_tc 0.82377 0.82650 0.002729 sigma_log_b_tt_hw 0.37341 0.97699 0.603575 sigma_log_b_tc_hw 0.22103 0.27258 0.051553 sigma_log_b_hw 0.87099 1.08693 0.215940 sigma_log_b_tt_ch 0.89195 1.17382 0.281869 sigma_log_b_tc_ch 0.05961 0.06296 0.003351 sigma_log_b_hw_ch 0.44925 0.40958 -0.039675 sigma_log_b_ch 0.66430 0.72634 0.062048 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.32145336 mu_log_b_tc 0.43543848 mu_log_b_hw 2.37079989 mu_log_b_ch 1.22088016 sigma_log_b_tt 1.42174774 sigma_log_b_tt_tc 1.81356083 sigma_log_b_tc 0.82650224 sigma_log_b_tt_hw 0.97698934 sigma_log_b_tc_hw 0.27257945 sigma_log_b_hw 1.08693277 sigma_log_b_tt_ch 1.17381558 sigma_log_b_tc_ch 0.06296355 sigma_log_b_hw_ch 0.40957683 sigma_log_b_ch 0.72634408 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) }