Model run using Apollo for R, version 0.2.3 on Darwin by stephane.hess www.ApolloChoiceModelling.com Model name : Apollo_example_29 Model description : Mixed logit model on Swiss route choice data, correlated Lognormals in utility space, EM algorithm Model run at : 2021-02-05 16:45:49 Estimation method : EM algorithm (bfgs) -> Maximum likelihood (bfgs) Model diagnosis : successful convergence 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.718 LL(0) : -2420.47 LL(final) : -1406.823 Rho-square (0) : 0.4188 Adj.Rho-square (0) : 0.413 AIC : 2841.65 BIC : 2927.86 Estimated parameters : 14 Time taken (hh:mm:ss) : 00:06:46.59 pre-estimation : 00:00:48.96 estimation : 00:03:44.78 post-estimation : 00:02:12.86 Iterations : 92 (EM) & 42 (bfgs) Min abs eigenvalue of Hessian : 6.918389 Estimates: Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0) mu_log_b_tt -1.48208 0.13429 -11.0364 0.12384 -11.967 mu_log_b_tc -0.59278 0.14674 -4.0396 0.13263 -4.469 mu_log_b_hw -2.45064 0.14143 -17.3274 0.15632 -15.677 mu_log_b_ch 1.10963 0.13574 8.1744 0.14017 7.917 sigma_log_b_tt 1.38752 0.17360 7.9928 0.17738 7.822 sigma_log_b_tt_tc 1.64144 0.17416 9.4249 0.17485 9.388 sigma_log_b_tc 0.87695 0.03451 25.4114 0.02390 36.691 sigma_log_b_tt_hw 0.55635 0.16014 3.4741 0.16112 3.453 sigma_log_b_tc_hw 0.26791 0.11584 2.3127 0.12273 2.183 sigma_log_b_hw 0.92271 0.05776 15.9740 0.04896 18.845 sigma_log_b_tt_ch 1.15439 0.16747 6.8931 0.16988 6.795 sigma_log_b_tc_ch 0.03924 0.05053 0.7765 0.03851 1.019 sigma_log_b_hw_ch 0.49509 0.05903 8.3871 0.05132 9.648 sigma_log_b_ch 0.63761 0.05481 11.6321 0.04446 14.340 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.01803 0.018173 0.012460 0.014882 mu_log_b_tc 0.01817 0.021533 0.013228 0.015675 mu_log_b_hw 0.01246 0.013228 0.020003 0.015343 mu_log_b_ch 0.01488 0.015675 0.015343 0.018427 sigma_log_b_tt 0.01058 0.010929 0.016230 0.014842 sigma_log_b_tt_tc 0.01056 0.009772 0.016015 0.014566 sigma_log_b_tc -3.9079e-04 -7.4311e-04 -1.0752e-04 -2.7157e-04 sigma_log_b_tt_hw 0.01173 0.011942 0.014305 0.013823 sigma_log_b_tc_hw 5.7155e-04 4.6412e-04 -0.004656 -0.001129 sigma_log_b_hw 9.8227e-04 0.001365 0.001052 0.001313 sigma_log_b_tt_ch 0.01139 0.011521 0.016054 0.013585 sigma_log_b_tc_ch 1.329e-05 -1.3814e-04 -9.0077e-04 -1.6906e-04 sigma_log_b_hw_ch -6.7679e-04 -7.3761e-04 0.001432 -2.5955e-04 sigma_log_b_ch 5.0309e-04 3.3606e-04 -8.1813e-04 -1.0372e-04 sigma_log_b_tt sigma_log_b_tt_tc sigma_log_b_tc sigma_log_b_tt_hw mu_log_b_tt 0.01058 0.010560 -3.9079e-04 0.011734 mu_log_b_tc 0.01093 0.009772 -7.4311e-04 0.011942 mu_log_b_hw 0.01623 0.016015 -1.0752e-04 0.014305 mu_log_b_ch 0.01484 0.014566 -2.7157e-04 0.013823 sigma_log_b_tt 0.03014 0.029997 -4.9484e-04 0.025914 sigma_log_b_tt_tc 0.03000 0.030332 -5.4114e-04 0.025914 sigma_log_b_tc -4.9484e-04 -5.4114e-04 0.001191 -6.5192e-04 sigma_log_b_tt_hw 0.02591 0.025914 -6.5192e-04 0.025646 sigma_log_b_tc_hw -8.1446e-04 -0.001067 0.001090 -0.002296 sigma_log_b_hw 5.1341e-04 4.2292e-04 4.435e-07 2.4269e-04 sigma_log_b_tt_ch 0.02811 0.028096 -4.0868e-04 0.024994 sigma_log_b_tc_ch 2.3577e-04 1.5984e-04 6.9909e-04 -2.5544e-04 sigma_log_b_hw_ch -9.3988e-04 -8.9697e-04 7.4189e-04 -8.1434e-04 sigma_log_b_ch 2.4553e-04 2.0927e-04 5.9928e-04 -7.726e-05 sigma_log_b_tc_hw sigma_log_b_hw sigma_log_b_tt_ch sigma_log_b_tc_ch mu_log_b_tt 5.7155e-04 9.8227e-04 0.011388 1.329e-05 mu_log_b_tc 4.6412e-04 0.001365 0.011521 -1.3814e-04 mu_log_b_hw -0.004656 0.001052 0.016054 -9.0077e-04 mu_log_b_ch -0.001129 0.001313 0.013585 -1.6906e-04 sigma_log_b_tt -8.1446e-04 5.1341e-04 0.028109 2.3577e-04 sigma_log_b_tt_tc -0.001067 4.2292e-04 0.028096 1.5984e-04 sigma_log_b_tc 0.001090 4.435e-07 -4.0868e-04 6.9909e-04 sigma_log_b_tt_hw -0.002296 2.4269e-04 0.024994 -2.5544e-04 sigma_log_b_tc_hw 0.013420 -0.004311 -0.002628 0.003588 sigma_log_b_hw -0.004311 0.003337 0.001370 -0.001204 sigma_log_b_tt_ch -0.002628 0.001370 0.028047 -7.2496e-04 sigma_log_b_tc_ch 0.003588 -0.001204 -7.2496e-04 0.002554 sigma_log_b_hw_ch -0.003537 0.001860 3.3512e-04 -0.001428 sigma_log_b_ch 0.002550 -6.0984e-04 -7.7292e-04 4.7810e-04 sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt -6.7679e-04 5.0309e-04 mu_log_b_tc -7.3761e-04 3.3606e-04 mu_log_b_hw 0.001432 -8.1813e-04 mu_log_b_ch -2.5955e-04 -1.0372e-04 sigma_log_b_tt -9.3988e-04 2.4553e-04 sigma_log_b_tt_tc -8.9697e-04 2.0927e-04 sigma_log_b_tc 7.4189e-04 5.9928e-04 sigma_log_b_tt_hw -8.1434e-04 -7.726e-05 sigma_log_b_tc_hw -0.003537 0.002550 sigma_log_b_hw 0.001860 -6.0984e-04 sigma_log_b_tt_ch 3.3512e-04 -7.7292e-04 sigma_log_b_tc_ch -0.001428 4.7810e-04 sigma_log_b_hw_ch 0.003485 -6.9904e-04 sigma_log_b_ch -6.9904e-04 0.003005 Robust covariance matrix: mu_log_b_tt mu_log_b_tc mu_log_b_hw mu_log_b_ch mu_log_b_tt 0.015338 0.015509 0.011634 0.013743 mu_log_b_tc 0.015509 0.017591 0.013685 0.015522 mu_log_b_hw 0.011634 0.013685 0.024437 0.017976 mu_log_b_ch 0.013743 0.015522 0.017976 0.019647 sigma_log_b_tt 0.009977 0.011683 0.019042 0.016980 sigma_log_b_tt_tc 0.009864 0.010946 0.018452 0.016405 sigma_log_b_tc -4.219e-05 -4.1573e-04 -3.2614e-04 -5.1726e-04 sigma_log_b_tt_hw 0.010194 0.011575 0.015958 0.015344 sigma_log_b_tc_hw 0.001738 -3.5145e-04 -0.009666 -0.003971 sigma_log_b_hw 2.9370e-04 0.001288 0.003018 0.001946 sigma_log_b_tt_ch 0.010015 0.011629 0.018964 0.015533 sigma_log_b_tc_ch 6.0091e-04 -1.5231e-04 -0.002319 -8.9396e-04 sigma_log_b_hw_ch -8.0827e-04 -2.1236e-04 0.003296 5.7111e-04 sigma_log_b_ch 5.6392e-04 -6.514e-05 -0.002303 -0.001039 sigma_log_b_tt sigma_log_b_tt_tc sigma_log_b_tc sigma_log_b_tt_hw mu_log_b_tt 0.009977 0.009864 -4.219e-05 0.010194 mu_log_b_tc 0.011683 0.010946 -4.1573e-04 0.011575 mu_log_b_hw 0.019042 0.018452 -3.2614e-04 0.015958 mu_log_b_ch 0.016980 0.016405 -5.1726e-04 0.015344 sigma_log_b_tt 0.031464 0.030910 -6.1984e-04 0.027805 sigma_log_b_tt_tc 0.030910 0.030574 -5.5906e-04 0.027385 sigma_log_b_tc -6.1984e-04 -5.5906e-04 5.7126e-04 -6.3710e-04 sigma_log_b_tt_hw 0.027805 0.027385 -6.3710e-04 0.025959 sigma_log_b_tc_hw -0.005048 -0.004644 9.9792e-04 -0.004383 sigma_log_b_hw 0.001740 0.001477 -2.1491e-04 0.001433 sigma_log_b_tt_ch 0.029584 0.029092 -4.9877e-04 0.026535 sigma_log_b_tc_ch -9.9358e-04 -8.3642e-04 3.9001e-04 -8.8529e-04 sigma_log_b_hw_ch 5.7872e-04 4.2860e-04 2.8638e-04 4.4009e-04 sigma_log_b_ch -9.3555e-04 -8.2681e-04 4.6351e-04 -0.001012 sigma_log_b_tc_hw sigma_log_b_hw sigma_log_b_tt_ch sigma_log_b_tc_ch mu_log_b_tt 0.001738 2.9370e-04 0.010015 6.0091e-04 mu_log_b_tc -3.5145e-04 0.001288 0.011629 -1.5231e-04 mu_log_b_hw -0.009666 0.003018 0.018964 -0.002319 mu_log_b_ch -0.003971 0.001946 0.015533 -8.9396e-04 sigma_log_b_tt -0.005048 0.001740 0.029584 -9.9358e-04 sigma_log_b_tt_tc -0.004644 0.001477 0.029092 -8.3642e-04 sigma_log_b_tc 9.9792e-04 -2.1491e-04 -4.9877e-04 3.9001e-04 sigma_log_b_tt_hw -0.004383 0.001433 0.026535 -8.8529e-04 sigma_log_b_tc_hw 0.015062 -0.005043 -0.006471 0.003968 sigma_log_b_hw -0.005043 0.002397 0.002351 -0.001316 sigma_log_b_tt_ch -0.006471 0.002351 0.028859 -0.001418 sigma_log_b_tc_ch 0.003968 -0.001316 -0.001418 0.001483 sigma_log_b_hw_ch -0.004891 0.001830 0.001563 -0.001397 sigma_log_b_ch 0.004110 -0.001228 -0.001505 9.0852e-04 sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt -8.0827e-04 5.6392e-04 mu_log_b_tc -2.1236e-04 -6.514e-05 mu_log_b_hw 0.003296 -0.002303 mu_log_b_ch 5.7111e-04 -0.001039 sigma_log_b_tt 5.7872e-04 -9.3555e-04 sigma_log_b_tt_tc 4.2860e-04 -8.2681e-04 sigma_log_b_tc 2.8638e-04 4.6351e-04 sigma_log_b_tt_hw 4.4009e-04 -0.001012 sigma_log_b_tc_hw -0.004891 0.004110 sigma_log_b_hw 0.001830 -0.001228 sigma_log_b_tt_ch 0.001563 -0.001505 sigma_log_b_tc_ch -0.001397 9.0852e-04 sigma_log_b_hw_ch 0.002633 -0.001127 sigma_log_b_ch -0.001127 0.001977 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.92221 0.65605 0.81636 mu_log_b_tc 0.922212 1.00000 0.63738 0.78692 mu_log_b_hw 0.656050 0.63738 1.00000 0.79919 mu_log_b_ch 0.816361 0.78692 0.79919 1.00000 sigma_log_b_tt 0.453938 0.42904 0.66105 0.62984 sigma_log_b_tt_tc 0.451535 0.38236 0.65019 0.61611 sigma_log_b_tc -0.084324 -0.14674 -0.02203 -0.05797 sigma_log_b_tt_hw 0.545619 0.50817 0.63159 0.63588 sigma_log_b_tc_hw 0.036740 0.02730 -0.28419 -0.07181 sigma_log_b_hw 0.126630 0.16105 0.12875 0.16747 sigma_log_b_tt_ch 0.506370 0.46879 0.67778 0.59757 sigma_log_b_tc_ch 0.001959 -0.01863 -0.12603 -0.02465 sigma_log_b_hw_ch -0.085377 -0.08515 0.17147 -0.03239 sigma_log_b_ch 0.068345 0.04178 -0.10553 -0.01394 sigma_log_b_tt sigma_log_b_tt_tc sigma_log_b_tc sigma_log_b_tt_hw mu_log_b_tt 0.45394 0.45154 -0.08432 0.545619 mu_log_b_tc 0.42904 0.38236 -0.14674 0.508166 mu_log_b_hw 0.66105 0.65019 -0.02203 0.631585 mu_log_b_ch 0.62984 0.61611 -0.05797 0.635885 sigma_log_b_tt 1.00000 0.99219 -0.08260 0.932147 sigma_log_b_tt_tc 0.99219 1.00000 -0.09004 0.929149 sigma_log_b_tc -0.08260 -0.09004 1.00000 -0.117961 sigma_log_b_tt_hw 0.93215 0.92915 -0.11796 1.000000 sigma_log_b_tc_hw -0.04050 -0.05289 0.27260 -0.123772 sigma_log_b_hw 0.05120 0.04204 2.2247e-04 0.026236 sigma_log_b_tt_ch 0.96686 0.96330 -0.07071 0.931940 sigma_log_b_tc_ch 0.02688 0.01816 0.40087 -0.031565 sigma_log_b_hw_ch -0.09172 -0.08725 0.36418 -0.086144 sigma_log_b_ch 0.02580 0.02192 0.31680 -0.008802 sigma_log_b_tc_hw sigma_log_b_hw sigma_log_b_tt_ch sigma_log_b_tc_ch mu_log_b_tt 0.03674 0.12663 0.50637 0.001959 mu_log_b_tc 0.02730 0.16105 0.46879 -0.018629 mu_log_b_hw -0.28419 0.12875 0.67778 -0.126035 mu_log_b_ch -0.07181 0.16747 0.59757 -0.024646 sigma_log_b_tt -0.04050 0.05120 0.96686 0.026876 sigma_log_b_tt_tc -0.05289 0.04204 0.96330 0.018162 sigma_log_b_tc 0.27260 2.2247e-04 -0.07071 0.400874 sigma_log_b_tt_hw -0.12377 0.02624 0.93194 -0.031565 sigma_log_b_tc_hw 1.00000 -0.64430 -0.13548 0.612934 sigma_log_b_hw -0.64430 1.00000 0.14165 -0.412559 sigma_log_b_tt_ch -0.13548 0.14165 1.00000 -0.085664 sigma_log_b_tc_ch 0.61293 -0.41256 -0.08566 1.000000 sigma_log_b_hw_ch -0.51731 0.54546 0.03390 -0.478708 sigma_log_b_ch 0.40156 -0.19261 -0.08420 0.172603 sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt -0.08538 0.068345 mu_log_b_tc -0.08515 0.041780 mu_log_b_hw 0.17147 -0.105531 mu_log_b_ch -0.03239 -0.013939 sigma_log_b_tt -0.09172 0.025803 sigma_log_b_tt_tc -0.08725 0.021921 sigma_log_b_tc 0.36418 0.316801 sigma_log_b_tt_hw -0.08614 -0.008802 sigma_log_b_tc_hw -0.51731 0.401563 sigma_log_b_hw 0.54546 -0.192606 sigma_log_b_tt_ch 0.03390 -0.084197 sigma_log_b_tc_ch -0.47871 0.172603 sigma_log_b_hw_ch 1.00000 -0.216040 sigma_log_b_ch -0.21604 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.00000 0.94420 0.60095 0.79172 mu_log_b_tc 0.94420 1.00000 0.66006 0.83495 mu_log_b_hw 0.60095 0.66006 1.00000 0.82038 mu_log_b_ch 0.79172 0.83495 0.82038 1.00000 sigma_log_b_tt 0.45415 0.49661 0.68671 0.68294 sigma_log_b_tt_tc 0.45551 0.47199 0.67507 0.66934 sigma_log_b_tc -0.01425 -0.13114 -0.08729 -0.15440 sigma_log_b_tt_hw 0.51090 0.54169 0.63360 0.67946 sigma_log_b_tc_hw 0.11437 -0.02159 -0.50381 -0.23084 sigma_log_b_hw 0.04843 0.19830 0.39423 0.28360 sigma_log_b_tt_ch 0.47605 0.51613 0.71412 0.65233 sigma_log_b_tc_ch 0.12599 -0.02982 -0.38527 -0.16561 sigma_log_b_hw_ch -0.12718 -0.03120 0.41091 0.07940 sigma_log_b_ch 0.10241 -0.01105 -0.33135 -0.16674 sigma_log_b_tt sigma_log_b_tt_tc sigma_log_b_tc sigma_log_b_tt_hw mu_log_b_tt 0.45415 0.45551 -0.01425 0.51090 mu_log_b_tc 0.49661 0.47199 -0.13114 0.54169 mu_log_b_hw 0.68671 0.67507 -0.08729 0.63360 mu_log_b_ch 0.68294 0.66934 -0.15440 0.67946 sigma_log_b_tt 1.00000 0.99659 -0.14620 0.97293 sigma_log_b_tt_tc 0.99659 1.00000 -0.13377 0.97206 sigma_log_b_tc -0.14620 -0.13377 1.00000 -0.16544 sigma_log_b_tt_hw 0.97293 0.97206 -0.16544 1.00000 sigma_log_b_tc_hw -0.23188 -0.21640 0.34020 -0.22165 sigma_log_b_hw 0.20034 0.17254 -0.18364 0.18170 sigma_log_b_tt_ch 0.98178 0.97940 -0.12284 0.96948 sigma_log_b_tc_ch -0.14545 -0.12421 0.42371 -0.14268 sigma_log_b_hw_ch 0.06358 0.04777 0.23349 0.05323 sigma_log_b_ch -0.11862 -0.10635 0.43616 -0.14132 sigma_log_b_tc_hw sigma_log_b_hw sigma_log_b_tt_ch sigma_log_b_tc_ch mu_log_b_tt 0.11437 0.04843 0.4760 0.12599 mu_log_b_tc -0.02159 0.19830 0.5161 -0.02982 mu_log_b_hw -0.50381 0.39423 0.7141 -0.38527 mu_log_b_ch -0.23084 0.28360 0.6523 -0.16561 sigma_log_b_tt -0.23188 0.20034 0.9818 -0.14545 sigma_log_b_tt_tc -0.21640 0.17254 0.9794 -0.12421 sigma_log_b_tc 0.34020 -0.18364 -0.1228 0.42371 sigma_log_b_tt_hw -0.22165 0.18170 0.9695 -0.14268 sigma_log_b_tc_hw 1.00000 -0.83915 -0.3104 0.83959 sigma_log_b_hw -0.83915 1.00000 0.2826 -0.69806 sigma_log_b_tt_ch -0.31038 0.28264 1.0000 -0.21677 sigma_log_b_tc_ch 0.83959 -0.69806 -0.2168 1.00000 sigma_log_b_hw_ch -0.77655 0.72833 0.1793 -0.70676 sigma_log_b_ch 0.75327 -0.56396 -0.1993 0.53059 sigma_log_b_hw_ch sigma_log_b_ch mu_log_b_tt -0.12718 0.10241 mu_log_b_tc -0.03120 -0.01105 mu_log_b_hw 0.41091 -0.33135 mu_log_b_ch 0.07940 -0.16674 sigma_log_b_tt 0.06358 -0.11862 sigma_log_b_tt_tc 0.04777 -0.10635 sigma_log_b_tc 0.23349 0.43616 sigma_log_b_tt_hw 0.05323 -0.14132 sigma_log_b_tc_hw -0.77655 0.75327 sigma_log_b_hw 0.72833 -0.56396 sigma_log_b_tt_ch 0.17929 -0.19931 sigma_log_b_tc_ch -0.70676 0.53059 sigma_log_b_hw_ch 1.00000 -0.49403 sigma_log_b_ch -0.49403 1.00000 20 worst outliers in terms of lowest average per choice prediction: ID Avg prob per choice 22580 0.3303292 23205 0.3342357 15174 0.3427434 16178 0.3510793 76862 0.3656539 16489 0.3672311 21623 0.3748923 16617 0.3796260 22961 0.3810581 15056 0.3868847 22820 0.3938684 20100 0.3943498 17187 0.4016503 15312 0.4058503 12534 0.4078769 21922 0.4098615 17645 0.4135960 24627 0.4175399 16184 0.4201263 13214 0.4208330 Changes in parameter estimates from starting values: Initial Estimate Difference mu_log_b_tt -1.61530 -1.48208 0.13322 mu_log_b_tc -0.70214 -0.59278 0.10936 mu_log_b_hw -2.62598 -2.45064 0.17534 mu_log_b_ch 0.91590 1.10963 0.19373 sigma_log_b_tt 1.05987 1.38752 0.32764 sigma_log_b_tt_tc 1.43539 1.64144 0.20605 sigma_log_b_tc 0.82377 0.87695 0.05318 sigma_log_b_tt_hw 0.37341 0.55635 0.18294 sigma_log_b_tc_hw 0.22103 0.26791 0.04688 sigma_log_b_hw 0.87099 0.92271 0.05172 sigma_log_b_tt_ch 0.89195 1.15439 0.26245 sigma_log_b_tc_ch 0.05961 0.03924 -0.02037 sigma_log_b_hw_ch 0.44925 0.49509 0.04584 sigma_log_b_ch 0.66430 0.63761 -0.02669 Settings and functions used in model definition: apollo_control -------------- Value modelName "Apollo_example_29" modelDescr "Mixed logit model on Swiss route choice data, correlated Lognormals in utility space, EM algorithm" indivID "ID" mixing "TRUE" nCores "2" debug "FALSE" workInLogs "FALSE" seed "13" HB "FALSE" noValidation "TRUE" noDiagnostics "TRUE" panelData "TRUE" analyticGrad "TRUE" Hessian routines attempted -------------- numerical jacobian of LL analytical gradient Scaling used in computing Hessian -------------- Value mu_log_b_tt 1.48207573 mu_log_b_tc 0.59278039 mu_log_b_hw 2.45064188 mu_log_b_ch 1.10963339 sigma_log_b_tt 1.38751782 sigma_log_b_tt_tc 1.64144114 sigma_log_b_tc 0.87695354 sigma_log_b_tt_hw 0.55635067 sigma_log_b_tc_hw 0.26791049 sigma_log_b_hw 0.92271317 sigma_log_b_tt_ch 1.15439299 sigma_log_b_tc_ch 0.03923771 sigma_log_b_hw_ch 0.49508960 sigma_log_b_ch 0.63761012 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, V = 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)