Model run by stephane.hess using Apollo 0.3.4 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 : MMNL_preference_space_correlated Model description : Mixed logit model on Swiss route choice data, correlated Lognormals in utility space Model run at : 2024-09-27 17:03:39.434748 Estimation method : bgw Model diagnosis : Relative function convergence Optimisation diagnosis : Maximum found hessian properties : Negative definite maximum eigenvalue : -6.528345 reciprocal of condition number : 0.000176356 Number of individuals : 388 Number of rows in database : 3492 Number of modelled outcomes : 3492 Number of cores used : 4 Number of inter-individual draws : 500 (halton) LL(start) : -1444.35 LL at equal shares, LL(0) : -2420.47 LL at observed shares, LL(C) : -2420.39 LL(final) : -1406.68 Rho-squared vs equal shares : 0.4188 Adj.Rho-squared vs equal shares : 0.4131 Rho-squared vs observed shares : 0.4188 Adj.Rho-squared vs observed shares : 0.4134 AIC : 2841.36 BIC : 2927.58 Estimated parameters : 14 Time taken (hh:mm:ss) : 00:00:55.94 pre-estimation : 00:00:7.73 estimation : 00:00:12.17 post-estimation : 00:00:36.04 Iterations : 26 Unconstrained optimisation. Estimates: Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0) mu_log_b_tt -1.3320 0.14344 -9.286 0.14155 -9.410 sigma_log_b_tt -1.3440 0.17285 -7.776 0.17421 -7.715 mu_log_b_tc -0.3981 0.16799 -2.370 0.16711 -2.382 sigma_log_b_tt_tc -1.6301 0.17512 -9.309 0.17319 -9.412 sigma_log_b_tc -0.7553 0.02518 -29.998 0.01643 -45.961 mu_log_b_hw -2.3914 0.14607 -16.372 0.14804 -16.153 sigma_log_b_tt_hw -0.8931 0.16840 -5.304 0.16478 -5.420 sigma_log_b_tc_hw -0.1721 0.04686 -3.673 0.02437 -7.063 sigma_log_b_hw -1.0132 0.05734 -17.670 0.04090 -24.773 mu_log_b_ch 1.1582 0.14703 7.878 0.15338 7.551 sigma_log_b_tt_ch -1.2333 0.16833 -7.327 0.16571 -7.442 sigma_log_b_tc_ch -0.1843 0.05229 -3.524 0.03652 -5.047 sigma_log_b_hw_ch -0.3781 0.05803 -6.515 0.04333 -8.726 sigma_log_b_ch 0.8266 0.04583 18.037 0.02859 28.910 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 sigma_log_b_tt mu_log_b_tc sigma_log_b_tt_tc sigma_log_b_tc mu_log_b_tt 0.020574 -0.012734 0.022040 -0.012022 5.1327e-04 sigma_log_b_tt -0.012734 0.029878 -0.012581 0.029756 -5.6768e-04 mu_log_b_tc 0.022040 -0.012581 0.028220 -0.009778 9.3716e-04 sigma_log_b_tt_tc -0.012022 0.029756 -0.009778 0.030665 -3.4151e-04 sigma_log_b_tc 5.1327e-04 -5.6768e-04 9.3716e-04 -3.4151e-04 6.3393e-04 mu_log_b_hw 0.015841 -0.016087 0.016682 -0.015595 2.4513e-04 sigma_log_b_tt_hw -0.014436 0.027084 -0.014273 0.026981 -3.2620e-04 sigma_log_b_tc_hw -6.4304e-04 -4.4782e-04 -0.001366 -6.8477e-04 5.3373e-04 sigma_log_b_hw -0.001272 0.001027 -0.002310 4.8673e-04 -4.2988e-04 mu_log_b_ch 0.017191 -0.015518 0.018745 -0.014626 5.5487e-04 sigma_log_b_tt_ch -0.013958 0.027949 -0.013517 0.028109 -1.9310e-04 sigma_log_b_tc_ch -4.1326e-04 -7.6584e-04 -0.001236 -9.1062e-04 7.3453e-04 sigma_log_b_hw_ch -7.7564e-04 7.3156e-04 -0.001929 2.083e-05 -5.1997e-04 sigma_log_b_ch 7.7805e-04 -4.7713e-04 0.001724 -3.151e-05 -1.1314e-04 mu_log_b_hw sigma_log_b_tt_hw sigma_log_b_tc_hw sigma_log_b_hw mu_log_b_ch mu_log_b_tt 0.01584 -0.01444 -6.4304e-04 -0.001272 0.017191 sigma_log_b_tt -0.01609 0.02708 -4.4782e-04 0.001027 -0.015518 mu_log_b_tc 0.01668 -0.01427 -0.001366 -0.002310 0.018745 sigma_log_b_tt_tc -0.01559 0.02698 -6.8477e-04 4.8673e-04 -0.014626 sigma_log_b_tc 2.4513e-04 -3.2620e-04 5.3373e-04 -4.2988e-04 5.5487e-04 mu_log_b_hw 0.02134 -0.01382 1.9906e-04 3.3302e-04 0.016950 sigma_log_b_tt_hw -0.01382 0.02836 2.2950e-04 3.3091e-04 -0.015294 sigma_log_b_tc_hw 1.9906e-04 2.2950e-04 0.002196 -1.3793e-04 -3.1994e-04 sigma_log_b_hw 3.3302e-04 3.3091e-04 -1.3793e-04 0.003288 -0.001794 mu_log_b_ch 0.01695 -0.01529 -3.1994e-04 -0.001794 0.021617 sigma_log_b_tt_ch -0.01533 0.02648 -6.781e-05 5.1086e-04 -0.013075 sigma_log_b_tc_ch 1.7594e-04 -6.2272e-04 0.001233 5.075e-06 8.8638e-04 sigma_log_b_hw_ch -8.4780e-04 9.9626e-04 -1.3163e-04 0.001929 -0.001796 sigma_log_b_ch 3.0663e-04 -1.7979e-04 -5.7440e-04 -7.348e-05 4.1611e-04 sigma_log_b_tt_ch sigma_log_b_tc_ch sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt -0.01396 -4.1326e-04 -7.7564e-04 7.7805e-04 sigma_log_b_tt 0.02795 -7.6584e-04 7.3156e-04 -4.7713e-04 mu_log_b_tc -0.01352 -0.001236 -0.001929 0.001724 sigma_log_b_tt_tc 0.02811 -9.1062e-04 2.083e-05 -3.151e-05 sigma_log_b_tc -1.9310e-04 7.3453e-04 -5.1997e-04 -1.1314e-04 mu_log_b_hw -0.01533 1.7594e-04 -8.4780e-04 3.0663e-04 sigma_log_b_tt_hw 0.02648 -6.2272e-04 9.9626e-04 -1.7979e-04 sigma_log_b_tc_hw -6.781e-05 0.001233 -1.3163e-04 -5.7440e-04 sigma_log_b_hw 5.1086e-04 5.075e-06 0.001929 -7.348e-05 mu_log_b_ch -0.01307 8.8638e-04 -0.001796 4.1611e-04 sigma_log_b_tt_ch 0.02833 2.2962e-04 -1.6104e-04 -3.4089e-04 sigma_log_b_tc_ch 2.2962e-04 0.002734 -6.2163e-04 -9.0289e-04 sigma_log_b_hw_ch -1.6104e-04 -6.2163e-04 0.003368 2.3625e-04 sigma_log_b_ch -3.4089e-04 -9.0289e-04 2.3625e-04 0.002100 Robust covariance matrix: mu_log_b_tt sigma_log_b_tt mu_log_b_tc sigma_log_b_tt_tc sigma_log_b_tc mu_log_b_tt 0.020037 -0.013071 0.021918 -0.01214 3.9018e-04 sigma_log_b_tt -0.013071 0.030349 -0.013918 0.02972 -7.3689e-04 mu_log_b_tc 0.021918 -0.013918 0.027927 -0.01107 9.7473e-04 sigma_log_b_tt_tc -0.012135 0.029717 -0.011072 0.02999 -4.2825e-04 sigma_log_b_tc 3.9018e-04 -7.3689e-04 9.7473e-04 -4.2825e-04 2.7006e-04 mu_log_b_hw 0.015998 -0.017293 0.017221 -0.01657 4.0493e-04 sigma_log_b_tt_hw -0.014238 0.027435 -0.014923 0.02688 -5.7277e-04 sigma_log_b_tc_hw -8.8511e-04 -4.8456e-04 -0.001205 -5.9905e-04 1.6991e-04 sigma_log_b_hw -0.001555 0.001547 -0.002945 8.6403e-04 -4.2456e-04 mu_log_b_ch 0.017586 -0.017208 0.020054 -0.01580 9.0059e-04 sigma_log_b_tt_ch -0.013801 0.027780 -0.013970 0.02759 -3.2035e-04 sigma_log_b_tc_ch -7.4671e-04 -9.7603e-04 -9.5657e-04 -9.4025e-04 3.6324e-04 sigma_log_b_hw_ch -0.001074 0.001699 -0.002633 8.4949e-04 -5.2566e-04 sigma_log_b_ch 0.001043 -4.3297e-04 0.001927 -5.642e-05 -3.832e-06 mu_log_b_hw sigma_log_b_tt_hw sigma_log_b_tc_hw sigma_log_b_hw mu_log_b_ch mu_log_b_tt 0.015998 -0.014238 -8.8511e-04 -0.001555 0.017586 sigma_log_b_tt -0.017293 0.027435 -4.8456e-04 0.001547 -0.017208 mu_log_b_tc 0.017221 -0.014923 -0.001205 -0.002945 0.020054 sigma_log_b_tt_tc -0.016574 0.026880 -5.9905e-04 8.6403e-04 -0.015798 sigma_log_b_tc 4.0493e-04 -5.7277e-04 1.6991e-04 -4.2456e-04 9.0059e-04 mu_log_b_hw 0.021917 -0.014387 1.9271e-04 -3.6829e-04 0.018222 sigma_log_b_tt_hw -0.014387 0.027151 1.8492e-04 0.001282 -0.016377 sigma_log_b_tc_hw 1.9271e-04 1.8492e-04 5.9382e-04 -9.738e-05 -1.6302e-04 sigma_log_b_hw -3.6829e-04 0.001282 -9.738e-05 0.001673 -0.002420 mu_log_b_ch 0.018222 -0.016377 -1.6302e-04 -0.002420 0.023526 sigma_log_b_tt_ch -0.015837 0.025950 -7.519e-05 8.4795e-04 -0.013759 sigma_log_b_tc_ch 3.1771e-04 -7.1462e-04 4.9643e-04 -1.6659e-04 0.001384 sigma_log_b_hw_ch -0.001300 0.001644 -9.256e-05 0.001169 -0.002799 sigma_log_b_ch 4.9693e-04 -3.4945e-04 -3.1865e-04 -2.4805e-04 5.4074e-04 sigma_log_b_tt_ch sigma_log_b_tc_ch sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt -0.01380 -7.4671e-04 -0.001074 0.001043 sigma_log_b_tt 0.02778 -9.7603e-04 0.001699 -4.3297e-04 mu_log_b_tc -0.01397 -9.5657e-04 -0.002633 0.001927 sigma_log_b_tt_tc 0.02759 -9.4025e-04 8.4949e-04 -5.642e-05 sigma_log_b_tc -3.2035e-04 3.6324e-04 -5.2566e-04 -3.832e-06 mu_log_b_hw -0.01584 3.1771e-04 -0.001300 4.9693e-04 sigma_log_b_tt_hw 0.02595 -7.1462e-04 0.001644 -3.4945e-04 sigma_log_b_tc_hw -7.519e-05 4.9643e-04 -9.256e-05 -3.1865e-04 sigma_log_b_hw 8.4795e-04 -1.6659e-04 0.001169 -2.4805e-04 mu_log_b_ch -0.01376 0.001384 -0.002799 5.4074e-04 sigma_log_b_tt_ch 0.02746 2.2368e-04 5.0564e-04 -5.2749e-04 sigma_log_b_tc_ch 2.2368e-04 0.001333 -7.5048e-04 -5.5405e-04 sigma_log_b_hw_ch 5.0564e-04 -7.5048e-04 0.001877 -3.709e-05 sigma_log_b_ch -5.2749e-04 -5.5405e-04 -3.709e-05 8.1757e-04 Classical correlation matrix: mu_log_b_tt sigma_log_b_tt mu_log_b_tc sigma_log_b_tt_tc sigma_log_b_tc mu_log_b_tt 1.00000 -0.51362 0.9147 -0.478621 0.14212 sigma_log_b_tt -0.51362 1.00000 -0.4333 0.983052 -0.13044 mu_log_b_tc 0.91468 -0.43327 1.0000 -0.332400 0.22157 sigma_log_b_tt_tc -0.47862 0.98305 -0.3324 1.000000 -0.07746 sigma_log_b_tc 0.14212 -0.13044 0.2216 -0.077457 1.00000 mu_log_b_hw 0.75610 -0.63715 0.6798 -0.609680 0.06665 sigma_log_b_tt_hw -0.59767 0.93047 -0.5045 0.914946 -0.07694 sigma_log_b_tc_hw -0.09566 -0.05528 -0.1735 -0.083441 0.45233 sigma_log_b_hw -0.15463 0.10362 -0.2398 0.048473 -0.29776 mu_log_b_ch 0.81517 -0.61062 0.7589 -0.568069 0.14989 sigma_log_b_tt_ch -0.57810 0.96057 -0.4780 0.953597 -0.04556 sigma_log_b_tc_ch -0.05510 -0.08473 -0.1408 -0.099451 0.55794 sigma_log_b_hw_ch -0.09318 0.07293 -0.1979 0.002049 -0.35586 sigma_log_b_ch 0.11836 -0.06023 0.2239 -0.003926 -0.09805 mu_log_b_hw sigma_log_b_tt_hw sigma_log_b_tc_hw sigma_log_b_hw mu_log_b_ch mu_log_b_tt 0.75610 -0.59767 -0.095662 -0.154629 0.81517 sigma_log_b_tt -0.63715 0.93047 -0.055282 0.103618 -0.61062 mu_log_b_tc 0.67983 -0.50454 -0.173550 -0.239799 0.75895 sigma_log_b_tt_tc -0.60968 0.91495 -0.083441 0.048473 -0.56807 sigma_log_b_tc 0.06665 -0.07694 0.452330 -0.297756 0.14989 mu_log_b_hw 1.00000 -0.56195 0.029079 0.039761 0.78924 sigma_log_b_tt_hw -0.56195 1.00000 0.029081 0.034269 -0.61772 sigma_log_b_tc_hw 0.02908 0.02908 1.000000 -0.051326 -0.04643 sigma_log_b_hw 0.03976 0.03427 -0.051326 1.000000 -0.21285 mu_log_b_ch 0.78924 -0.61772 -0.046434 -0.212846 1.00000 sigma_log_b_tt_ch -0.62332 0.93400 -0.008596 0.052928 -0.52830 sigma_log_b_tc_ch 0.02304 -0.07072 0.503297 0.001693 0.11530 sigma_log_b_hw_ch -0.10001 0.10194 -0.048398 0.579633 -0.21054 sigma_log_b_ch 0.04581 -0.02330 -0.267439 -0.027960 0.06176 sigma_log_b_tt_ch sigma_log_b_tc_ch sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt -0.578103 -0.055101 -0.093180 0.118361 sigma_log_b_tt 0.960569 -0.084733 0.072927 -0.060230 mu_log_b_tc -0.478008 -0.140770 -0.197867 0.223926 sigma_log_b_tt_tc 0.953597 -0.099451 0.002049 -0.003926 sigma_log_b_tc -0.045561 0.557941 -0.355861 -0.098048 mu_log_b_hw -0.623321 0.023036 -0.100013 0.045805 sigma_log_b_tt_hw 0.934000 -0.070722 0.101944 -0.023296 sigma_log_b_tc_hw -0.008596 0.503297 -0.048398 -0.267439 sigma_log_b_hw 0.052928 0.001693 0.579633 -0.027960 mu_log_b_ch -0.528298 0.115298 -0.210541 0.061755 sigma_log_b_tt_ch 1.000000 0.026089 -0.016485 -0.044188 sigma_log_b_tc_ch 0.026089 1.000000 -0.204854 -0.376782 sigma_log_b_hw_ch -0.016485 -0.204854 1.000000 0.088826 sigma_log_b_ch -0.044188 -0.376782 0.088826 1.000000 Robust correlation matrix: mu_log_b_tt sigma_log_b_tt mu_log_b_tc sigma_log_b_tt_tc sigma_log_b_tc mu_log_b_tt 1.0000 -0.53004 0.9266 -0.49502 0.167737 sigma_log_b_tt -0.5300 1.00000 -0.4781 0.98496 -0.257398 mu_log_b_tc 0.9266 -0.47808 1.0000 -0.38257 0.354931 sigma_log_b_tt_tc -0.4950 0.98496 -0.3826 1.00000 -0.150470 sigma_log_b_tc 0.1677 -0.25740 0.3549 -0.15047 1.000000 mu_log_b_hw 0.7634 -0.67053 0.6961 -0.64642 0.166439 sigma_log_b_tt_hw -0.6104 0.95572 -0.5419 0.94192 -0.211522 sigma_log_b_tc_hw -0.2566 -0.11414 -0.2960 -0.14195 0.424299 sigma_log_b_hw -0.2686 0.21717 -0.4309 0.12198 -0.631677 mu_log_b_ch 0.8100 -0.64400 0.7824 -0.59471 0.357297 sigma_log_b_tt_ch -0.5884 0.96228 -0.5045 0.96123 -0.117636 sigma_log_b_tc_ch -0.1445 -0.15343 -0.1568 -0.14868 0.605325 sigma_log_b_hw_ch -0.1752 0.22505 -0.3636 0.11320 -0.738220 sigma_log_b_ch 0.2577 -0.08692 0.4033 -0.01139 -0.008155 mu_log_b_hw sigma_log_b_tt_hw sigma_log_b_tc_hw sigma_log_b_hw mu_log_b_ch mu_log_b_tt 0.76344 -0.61042 -0.25660 -0.26865 0.80999 sigma_log_b_tt -0.67053 0.95572 -0.11414 0.21717 -0.64400 mu_log_b_tc 0.69609 -0.54195 -0.29602 -0.43091 0.78237 sigma_log_b_tt_tc -0.64642 0.94192 -0.14195 0.12198 -0.59471 sigma_log_b_tc 0.16644 -0.21152 0.42430 -0.63168 0.35730 mu_log_b_hw 1.00000 -0.58975 0.05342 -0.06082 0.80249 sigma_log_b_tt_hw -0.58975 1.00000 0.04605 0.19025 -0.64799 sigma_log_b_tc_hw 0.05342 0.04605 1.00000 -0.09771 -0.04362 sigma_log_b_hw -0.06082 0.19025 -0.09771 1.00000 -0.38576 mu_log_b_ch 0.80249 -0.64799 -0.04362 -0.38576 1.00000 sigma_log_b_tt_ch -0.64555 0.95033 -0.01862 0.12511 -0.54134 sigma_log_b_tc_ch 0.05877 -0.11877 0.55790 -0.11155 0.24711 sigma_log_b_hw_ch -0.20268 0.23028 -0.08766 0.65952 -0.42119 sigma_log_b_ch 0.11739 -0.07417 -0.45732 -0.21210 0.12330 sigma_log_b_tt_ch sigma_log_b_tc_ch sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt -0.58837 -0.14447 -0.17519 0.257673 sigma_log_b_tt 0.96228 -0.15343 0.22505 -0.086922 mu_log_b_tc -0.50445 -0.15676 -0.36364 0.403263 sigma_log_b_tt_tc 0.96123 -0.14868 0.11320 -0.011394 sigma_log_b_tc -0.11764 0.60533 -0.73822 -0.008155 mu_log_b_hw -0.64555 0.05877 -0.20268 0.117392 sigma_log_b_tt_hw 0.95033 -0.11877 0.23028 -0.074169 sigma_log_b_tc_hw -0.01862 0.55790 -0.08766 -0.457325 sigma_log_b_hw 0.12511 -0.11155 0.65952 -0.212104 mu_log_b_ch -0.54134 0.24711 -0.42119 0.123298 sigma_log_b_tt_ch 1.00000 0.03697 0.07042 -0.111325 sigma_log_b_tc_ch 0.03697 1.00000 -0.47433 -0.530653 sigma_log_b_hw_ch 0.07042 -0.47433 1.00000 -0.029933 sigma_log_b_ch -0.11132 -0.53065 -0.02993 1.000000 20 most extreme outliers in terms of lowest average per choice prediction: ID Avg prob per choice 23205 0.3446914 22580 0.3481014 15174 0.3522062 16178 0.3579553 16617 0.3683063 76862 0.3735038 16489 0.3802693 21623 0.3838086 21922 0.3926334 22961 0.3928810 15056 0.3933060 22820 0.4013412 17187 0.4037787 20100 0.4060605 15312 0.4085958 16184 0.4128450 14802 0.4143032 12534 0.4171506 17645 0.4187310 24627 0.4253900 Changes in parameter estimates from starting values: Initial Estimate Difference mu_log_b_tt -1.9838 -1.3320 0.65181 sigma_log_b_tt -0.4416 -1.3440 -0.90240 mu_log_b_tc -1.0158 -0.3981 0.61768 sigma_log_b_tt_tc 0.0000 -1.6301 -1.63010 sigma_log_b_tc -0.9913 -0.7553 0.23601 mu_log_b_hw -2.9378 -2.3914 0.54645 sigma_log_b_tt_hw 0.0000 -0.8931 -0.89311 sigma_log_b_tc_hw 0.0000 -0.1721 -0.17213 sigma_log_b_hw -0.8344 -1.0132 -0.17878 mu_log_b_ch 0.6312 1.1582 0.52708 sigma_log_b_tt_ch 0.0000 -1.2333 -1.23330 sigma_log_b_tc_ch 0.0000 -0.1843 -0.18427 sigma_log_b_hw_ch 0.0000 -0.3781 -0.37811 sigma_log_b_ch 0.8578 0.8266 -0.03118 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 Lognormals in utility space" indivID "ID" nCores "4" outputDirectory "output/" mixing "TRUE" debug "FALSE" workInLogs "FALSE" seed "13" HB "FALSE" noValidation "FALSE" noDiagnostics "FALSE" 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.3320041 sigma_log_b_tt 1.3440389 mu_log_b_tc 0.3980820 sigma_log_b_tt_tc 1.6300962 sigma_log_b_tc 0.7552906 mu_log_b_hw 2.3913890 sigma_log_b_tt_hw 0.8931055 sigma_log_b_tc_hw 0.1721253 sigma_log_b_hw 1.0132111 mu_log_b_ch 1.1582371 sigma_log_b_tt_ch 1.2332993 sigma_log_b_tc_ch 0.1842744 sigma_log_b_hw_ch 0.3781095 sigma_log_b_ch 0.8266367 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) }