Model run by stephane.hess using Apollo 0.2.9 on R 4.0.5 for Darwin. 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 : 2023-05-11 07:53:44 Estimation method : bfgs Model diagnosis : successful convergence Optimisation diagnosis : Maximum found hessian properties : Negative definitive maximum eigenvalue : -5.154337 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.47 LL at equal shares, LL(0) : -2420.47 LL at observed shares, LL(C) : -2420.39 LL(final) : -1408.57 Rho-squared vs equal shares : 0.4181 Adj.Rho-squared vs equal shares : 0.4123 Rho-squared vs observed shares : 0.418 Adj.Rho-squared vs observed shares : 0.4127 AIC : 2845.13 BIC : 2931.35 Estimated parameters : 14 Time taken (hh:mm:ss) : 00:04:20.65 pre-estimation : 00:00:43.72 estimation : 00:01:38.92 initial estimation : 00:01:33.4 estimation after rescaling : 00:00:5.52 post-estimation : 00:01:58.01 Iterations : 55 initial estimation : 54 estimation after rescaling : 1 Unconstrained optimisation. Estimates: Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0) mu_log_b_tt -1.3157 0.15851 -8.300 0.16938 -7.768 sigma_log_b_tt -1.2818 0.17480 -7.333 0.18788 -6.822 mu_log_b_tc -0.3615 0.17190 -2.103 0.17158 -2.107 sigma_log_b_tt_tc -1.7422 0.18945 -9.196 0.20601 -8.457 sigma_log_b_tc -0.8576 0.04336 -19.777 0.03315 -25.867 mu_log_b_hw -2.3063 0.15623 -14.762 0.16430 -14.037 sigma_log_b_tt_hw -0.8411 0.19408 -4.334 0.20803 -4.043 sigma_log_b_tc_hw -0.1713 0.08342 -2.053 0.05391 -3.177 sigma_log_b_hw 1.0658 0.07271 14.658 0.06221 17.132 mu_log_b_ch 1.2265 0.15840 7.743 0.16811 7.296 sigma_log_b_tt_ch -1.4528 0.19857 -7.316 0.20879 -6.958 sigma_log_b_tc_ch -0.1077 0.08675 -1.242 0.08265 -1.303 sigma_log_b_hw_ch 0.5707 0.06223 9.171 0.04755 12.002 sigma_log_b_ch -0.6395 0.05168 -12.375 0.04165 -15.353 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.025125 -0.017188 0.024621 -0.019517 0.001312 sigma_log_b_tt -0.017188 0.030554 -0.017158 0.031046 4.554e-05 mu_log_b_tc 0.024621 -0.017158 0.029549 -0.015498 7.6993e-04 sigma_log_b_tt_tc -0.019517 0.031046 -0.015498 0.035891 -9.7925e-04 sigma_log_b_tc 0.001312 4.554e-05 7.6993e-04 -9.7925e-04 0.001880 mu_log_b_hw 0.019358 -0.018964 0.020357 -0.019045 -1.8315e-04 sigma_log_b_tt_hw -0.022177 0.030154 -0.019243 0.035157 -0.001330 sigma_log_b_tc_hw 9.6683e-04 3.5501e-04 -4.7270e-04 -0.001008 0.001698 sigma_log_b_hw 0.001566 -6.0384e-04 0.001683 -8.8072e-04 6.3744e-04 mu_log_b_ch 0.021962 -0.018166 0.021935 -0.019659 4.5070e-04 sigma_log_b_tt_ch -0.022556 0.030772 -0.019359 0.035827 -0.001194 sigma_log_b_tc_ch 0.003097 7.0604e-04 8.0893e-04 -0.002035 0.002017 sigma_log_b_hw_ch -0.002467 0.001666 -0.001658 0.003150 -4.5633e-04 sigma_log_b_ch -5.3891e-04 -5.5996e-04 -6.9552e-04 -6.7135e-04 1.1110e-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.019358 -0.022177 9.6683e-04 0.001566 0.021962 sigma_log_b_tt -0.018964 0.030154 3.5501e-04 -6.0384e-04 -0.018166 mu_log_b_tc 0.020357 -0.019243 -4.7270e-04 0.001683 0.021935 sigma_log_b_tt_tc -0.019045 0.035157 -0.001008 -8.8072e-04 -0.019659 sigma_log_b_tc -1.8315e-04 -0.001330 0.001698 6.3744e-04 4.5070e-04 mu_log_b_hw 0.024408 -0.018539 -1.2460e-04 -0.001693 0.020284 sigma_log_b_tt_hw -0.018539 0.037669 -9.2213e-04 1.5677e-04 -0.020222 sigma_log_b_tc_hw -1.2460e-04 -9.2213e-04 0.006959 0.001337 2.4913e-04 sigma_log_b_hw -0.001693 1.5677e-04 0.001337 0.005287 0.001703 mu_log_b_ch 0.020284 -0.020222 2.4913e-04 0.001703 0.025090 sigma_log_b_tt_ch -0.019406 0.037134 -0.001100 -6.2475e-04 -0.019791 sigma_log_b_tc_ch -4.4132e-04 -0.003031 0.002659 3.8223e-04 0.001844 sigma_log_b_hw_ch -9.7620e-04 0.004323 -7.9721e-04 2.4366e-04 -0.002224 sigma_log_b_ch 3.2016e-04 -3.5771e-04 3.5409e-04 -1.3747e-04 2.6645e-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.022556 0.003097 -0.002467 -5.3891e-04 sigma_log_b_tt 0.030772 7.0604e-04 0.001666 -5.5996e-04 mu_log_b_tc -0.019359 8.0893e-04 -0.001658 -6.9552e-04 sigma_log_b_tt_tc 0.035827 -0.002035 0.003150 -6.7135e-04 sigma_log_b_tc -0.001194 0.002017 -4.5633e-04 1.1110e-04 mu_log_b_hw -0.019406 -4.4132e-04 -9.7620e-04 3.2016e-04 sigma_log_b_tt_hw 0.037134 -0.003031 0.004323 -3.5771e-04 sigma_log_b_tc_hw -0.001100 0.002659 -7.9721e-04 3.5409e-04 sigma_log_b_hw -6.2475e-04 3.8223e-04 2.4366e-04 -1.3747e-04 mu_log_b_ch -0.019791 0.001844 -0.002224 2.6645e-04 sigma_log_b_tt_ch 0.039431 -0.005026 0.003568 9.7244e-04 sigma_log_b_tc_ch -0.005026 0.007526 -8.4777e-04 -0.001648 sigma_log_b_hw_ch 0.003568 -8.4777e-04 0.003873 -9.5109e-04 sigma_log_b_ch 9.7244e-04 -0.001648 -9.5109e-04 0.002671 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.028689 -0.020485 0.026254 -0.024650 0.001552 sigma_log_b_tt -0.020485 0.035301 -0.020194 0.036523 -3.2060e-04 mu_log_b_tc 0.026254 -0.020194 0.029439 -0.019587 2.7876e-04 sigma_log_b_tt_tc -0.024650 0.036523 -0.019587 0.042439 -0.001796 sigma_log_b_tc 0.001552 -3.2060e-04 2.7876e-04 -0.001796 0.001099 mu_log_b_hw 0.022074 -0.022583 0.023008 -0.022690 -4.765e-05 sigma_log_b_tt_hw -0.026822 0.035672 -0.022155 0.041869 -0.001869 sigma_log_b_tc_hw 3.1786e-04 7.4389e-04 -9.4274e-04 -6.0010e-04 0.001166 sigma_log_b_hw 0.002156 -6.5268e-04 0.001720 -0.001457 8.2160e-04 mu_log_b_ch 0.025736 -0.021990 0.023658 -0.025423 0.001414 sigma_log_b_tt_ch -0.026974 0.035564 -0.022641 0.041497 -0.001697 sigma_log_b_tc_ch 0.003101 0.001376 5.116e-05 -0.002079 0.001543 sigma_log_b_hw_ch -0.003334 0.002205 -0.001919 0.004051 -8.8244e-04 sigma_log_b_ch -8.800e-05 -0.001143 -2.6888e-04 -0.001224 2.3435e-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.022074 -0.026822 3.1786e-04 0.002156 0.025736 sigma_log_b_tt -0.022583 0.035672 7.4389e-04 -6.5268e-04 -0.021990 mu_log_b_tc 0.023008 -0.022155 -9.4274e-04 0.001720 0.023658 sigma_log_b_tt_tc -0.022690 0.041869 -6.0010e-04 -0.001457 -0.025423 sigma_log_b_tc -4.765e-05 -0.001869 0.001166 8.2160e-04 0.001414 mu_log_b_hw 0.026996 -0.021881 -8.1391e-04 -0.001191 0.022450 sigma_log_b_tt_hw -0.021881 0.043275 -1.5018e-04 -0.001069 -0.025690 sigma_log_b_tc_hw -8.1391e-04 -1.5018e-04 0.002906 0.001646 4.8552e-04 sigma_log_b_hw -0.001191 -0.001069 0.001646 0.003870 0.002489 mu_log_b_ch 0.022450 -0.025690 4.8552e-04 0.002489 0.028260 sigma_log_b_tt_ch -0.022621 0.042631 -3.293e-05 -0.001148 -0.025294 sigma_log_b_tc_ch -0.001534 -0.003032 0.001231 7.9234e-04 0.002948 sigma_log_b_hw_ch -9.9459e-04 0.004546 -0.001108 -0.001066 -0.003043 sigma_log_b_ch 5.9718e-04 -8.0228e-04 6.0819e-04 2.7857e-04 4.9832e-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.026974 0.003101 -0.003334 -8.800e-05 sigma_log_b_tt 0.035564 0.001376 0.002205 -0.001143 mu_log_b_tc -0.022641 5.116e-05 -0.001919 -2.6888e-04 sigma_log_b_tt_tc 0.041497 -0.002079 0.004051 -0.001224 sigma_log_b_tc -0.001697 0.001543 -8.8244e-04 2.3435e-04 mu_log_b_hw -0.022621 -0.001534 -9.9459e-04 5.9718e-04 sigma_log_b_tt_hw 0.042631 -0.003032 0.004546 -8.0228e-04 sigma_log_b_tc_hw -3.293e-05 0.001231 -0.001108 6.0819e-04 sigma_log_b_hw -0.001148 7.9234e-04 -0.001066 2.7857e-04 mu_log_b_ch -0.025294 0.002948 -0.003043 4.9832e-04 sigma_log_b_tt_ch 0.043595 -0.004422 0.003925 4.8985e-04 sigma_log_b_tc_ch -0.004422 0.006831 -9.6724e-04 -0.001948 sigma_log_b_hw_ch 0.003925 -9.6724e-04 0.002261 -8.9094e-04 sigma_log_b_ch 4.8985e-04 -0.001948 -8.9094e-04 0.001735 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.620367 0.90359 -0.64992 0.190851 sigma_log_b_tt -0.62037 1.000000 -0.57102 0.93754 0.006008 mu_log_b_tc 0.90359 -0.571020 1.00000 -0.47589 0.103292 sigma_log_b_tt_tc -0.64992 0.937538 -0.47589 1.00000 -0.119204 sigma_log_b_tc 0.19085 0.006008 0.10329 -0.11920 1.000000 mu_log_b_hw 0.78168 -0.694436 0.75802 -0.64346 -0.027036 sigma_log_b_tt_hw -0.72085 0.888840 -0.57676 0.95615 -0.158015 sigma_log_b_tc_hw 0.07312 0.024347 -0.03296 -0.06377 0.469518 sigma_log_b_hw 0.13589 -0.047510 0.13467 -0.06393 0.202168 mu_log_b_ch 0.87470 -0.656126 0.80559 -0.65513 0.065618 sigma_log_b_tt_ch -0.71662 0.886552 -0.56714 0.95236 -0.138635 sigma_log_b_tc_ch 0.22521 0.046560 0.05424 -0.12384 0.536081 sigma_log_b_hw_ch -0.25014 0.153192 -0.15498 0.26723 -0.169111 sigma_log_b_ch -0.06579 -0.061987 -0.07829 -0.06857 0.049578 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.781683 -0.72085 0.073119 0.13589 0.87470 sigma_log_b_tt -0.694436 0.88884 0.024347 -0.04751 -0.65613 mu_log_b_tc 0.758023 -0.57676 -0.032965 0.13467 0.80559 sigma_log_b_tt_tc -0.643457 0.95615 -0.063766 -0.06393 -0.65513 sigma_log_b_tc -0.027036 -0.15801 0.469518 0.20217 0.06562 mu_log_b_hw 1.000000 -0.61140 -0.009560 -0.14906 0.81968 sigma_log_b_tt_hw -0.611395 1.00000 -0.056956 0.01111 -0.65777 sigma_log_b_tc_hw -0.009560 -0.05696 1.000000 0.22040 0.01885 sigma_log_b_hw -0.149055 0.01111 0.220400 1.00000 0.14790 mu_log_b_ch 0.819675 -0.65777 0.018854 0.14790 1.00000 sigma_log_b_tt_ch -0.625524 0.96352 -0.066409 -0.04327 -0.62922 sigma_log_b_tc_ch -0.032561 -0.18002 0.367476 0.06059 0.13417 sigma_log_b_hw_ch -0.100409 0.35795 -0.153573 0.05385 -0.22565 sigma_log_b_ch 0.039653 -0.03566 0.082135 -0.03658 0.03255 sigma_log_b_tt_ch sigma_log_b_tc_ch sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt -0.71662 0.22521 -0.25014 -0.06579 sigma_log_b_tt 0.88655 0.04656 0.15319 -0.06199 mu_log_b_tc -0.56714 0.05424 -0.15498 -0.07829 sigma_log_b_tt_tc 0.95236 -0.12384 0.26723 -0.06857 sigma_log_b_tc -0.13864 0.53608 -0.16911 0.04958 mu_log_b_hw -0.62552 -0.03256 -0.10041 0.03965 sigma_log_b_tt_hw 0.96352 -0.18002 0.35795 -0.03566 sigma_log_b_tc_hw -0.06641 0.36748 -0.15357 0.08213 sigma_log_b_hw -0.04327 0.06059 0.05385 -0.03658 mu_log_b_ch -0.62922 0.13417 -0.22565 0.03255 sigma_log_b_tt_ch 1.00000 -0.29176 0.28876 0.09476 sigma_log_b_tc_ch -0.29176 1.00000 -0.15703 -0.36751 sigma_log_b_hw_ch 0.28876 -0.15703 1.00000 -0.29573 sigma_log_b_ch 0.09476 -0.36751 -0.29573 1.00000 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.00000 -0.64369 0.903400 -0.70643 0.276444 sigma_log_b_tt -0.64369 1.00000 -0.626423 0.94361 -0.051469 mu_log_b_tc 0.90340 -0.62642 1.000000 -0.55416 0.049006 sigma_log_b_tt_tc -0.70643 0.94361 -0.554163 1.00000 -0.262947 sigma_log_b_tc 0.27644 -0.05147 0.049006 -0.26295 1.000000 mu_log_b_hw 0.79319 -0.73156 0.816169 -0.67036 -0.008747 sigma_log_b_tt_hw -0.76124 0.91269 -0.620734 0.97700 -0.270986 sigma_log_b_tc_hw 0.03481 0.07344 -0.101920 -0.05403 0.652397 sigma_log_b_hw 0.20459 -0.05584 0.161127 -0.11367 0.398355 mu_log_b_ch 0.90384 -0.69623 0.820236 -0.73410 0.253669 sigma_log_b_tt_ch -0.76272 0.90657 -0.632002 0.96475 -0.245176 sigma_log_b_tc_ch 0.22153 0.08862 0.003607 -0.12207 0.563173 sigma_log_b_hw_ch -0.41392 0.24685 -0.235206 0.41357 -0.559744 sigma_log_b_ch -0.01247 -0.14605 -0.037622 -0.14258 0.169699 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.793190 -0.76124 0.034810 0.20459 0.90384 sigma_log_b_tt -0.731556 0.91269 0.073442 -0.05584 -0.69623 mu_log_b_tc 0.816169 -0.62073 -0.101920 0.16113 0.82024 sigma_log_b_tt_tc -0.670364 0.97700 -0.054035 -0.11367 -0.73410 sigma_log_b_tc -0.008747 -0.27099 0.652397 0.39835 0.25367 mu_log_b_hw 1.000000 -0.64018 -0.091888 -0.11653 0.81278 sigma_log_b_tt_hw -0.640177 1.00000 -0.013391 -0.08259 -0.73462 sigma_log_b_tc_hw -0.091888 -0.01339 1.000000 0.49079 0.05357 sigma_log_b_hw -0.116528 -0.08259 0.490793 1.00000 0.23801 mu_log_b_ch 0.812780 -0.73462 0.053573 0.23801 1.00000 sigma_log_b_tt_ch -0.659405 0.98151 -0.002926 -0.08841 -0.72065 sigma_log_b_tc_ch -0.112932 -0.17636 0.276374 0.15410 0.21215 sigma_log_b_hw_ch -0.127299 0.45955 -0.432217 -0.36023 -0.38064 sigma_log_b_ch 0.087257 -0.09259 0.270840 0.10750 0.07116 sigma_log_b_tt_ch sigma_log_b_tc_ch sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt -0.762719 0.221534 -0.4139 -0.01247 sigma_log_b_tt 0.906570 0.088615 0.2469 -0.14605 mu_log_b_tc -0.632002 0.003607 -0.2352 -0.03762 sigma_log_b_tt_tc 0.964751 -0.122073 0.4136 -0.14258 sigma_log_b_tc -0.245176 0.563173 -0.5597 0.16970 mu_log_b_hw -0.659405 -0.112932 -0.1273 0.08726 sigma_log_b_tt_hw 0.981511 -0.176355 0.4596 -0.09259 sigma_log_b_tc_hw -0.002926 0.276374 -0.4322 0.27084 sigma_log_b_hw -0.088410 0.154099 -0.3602 0.10750 mu_log_b_ch -0.720647 0.212155 -0.3806 0.07116 sigma_log_b_tt_ch 1.000000 -0.256256 0.3954 0.05632 sigma_log_b_tc_ch -0.256256 1.000000 -0.2461 -0.56583 sigma_log_b_hw_ch 0.395370 -0.246103 1.0000 -0.44980 sigma_log_b_ch 0.056323 -0.565834 -0.4498 1.00000 20 worst outliers in terms of lowest average per choice prediction: ID Avg prob per choice 22580 0.3334811 23205 0.3457853 15174 0.3524317 16178 0.3543432 17187 0.3576135 16617 0.3628072 76862 0.3745597 21623 0.3758105 16489 0.3769477 22961 0.3920060 21922 0.3949363 15056 0.3978297 15312 0.3982421 20100 0.4043463 22820 0.4081385 16184 0.4089647 14754 0.4181684 12534 0.4199115 17645 0.4241797 20352 0.4275518 Changes in parameter estimates from starting values: Initial Estimate Difference mu_log_b_tt -1.9834 -1.3157 0.6676 sigma_log_b_tt -0.4662 -1.2818 -0.8156 mu_log_b_tc -1.0246 -0.3615 0.6630 sigma_log_b_tt_tc 0.0000 -1.7422 -1.7422 sigma_log_b_tc -0.9843 -0.8576 0.1267 mu_log_b_hw -2.9339 -2.3063 0.6276 sigma_log_b_tt_hw 0.0000 -0.8411 -0.8411 sigma_log_b_tc_hw 0.0000 -0.1713 -0.1713 sigma_log_b_hw 0.8163 1.0658 0.2495 mu_log_b_ch 0.6234 1.2265 0.6031 sigma_log_b_tt_ch 0.0000 -1.4528 -1.4528 sigma_log_b_tc_ch 0.0000 -0.1077 -0.1077 sigma_log_b_hw_ch 0.0000 0.5707 0.5707 sigma_log_b_ch -0.8263 -0.6395 0.1867 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" panelData "TRUE" analyticGrad "TRUE" analyticGrad_manualSet "FALSE" overridePanel "FALSE" preventOverridePanel "FALSE" noModification "FALSE" Hessian routines attempted -------------------------- numerical jacobian of LL analytical gradient Scaling in estimation --------------------- Value mu_log_b_tt 1.3157068 sigma_log_b_tt 1.2817759 mu_log_b_tc 0.3615491 sigma_log_b_tt_tc 1.7422343 sigma_log_b_tc 0.8575742 mu_log_b_hw 2.3062950 sigma_log_b_tt_hw 0.8411013 sigma_log_b_tc_hw 0.1712725 sigma_log_b_hw 1.0657940 mu_log_b_ch 1.2265048 sigma_log_b_tt_ch 1.4528239 sigma_log_b_tc_ch 0.1077156 sigma_log_b_hw_ch 0.5707109 sigma_log_b_ch 0.6395281 Scaling used in computing Hessian --------------------------------- Value mu_log_b_tt 1.3157066 sigma_log_b_tt 1.2817762 mu_log_b_tc 0.3615491 sigma_log_b_tt_tc 1.7422329 sigma_log_b_tc 0.8575741 mu_log_b_hw 2.3062948 sigma_log_b_tt_hw 0.8411016 sigma_log_b_tc_hw 0.1712725 sigma_log_b_hw 1.0657941 mu_log_b_ch 1.2265048 sigma_log_b_tt_ch 1.4528239 sigma_log_b_tc_ch 0.1077156 sigma_log_b_hw_ch 0.5707108 sigma_log_b_ch 0.6395282 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) }