Model run using Apollo for R, version 0.2.3 on Darwin by stephane.hess www.ApolloChoiceModelling.com Model name : Apollo_example_23 Model description : Best-worst model on drug choice data Model run at : 2021-02-04 19:05:05 Estimation method : bfgs Model diagnosis : successful convergence Number of individuals : 1000 Number of rows in database : 10000 Number of modelled outcomes : 20000 best: 10000 worst: 10000 Number of cores used : 1 Model without mixing LL(start) : -24849.07 LL(0, whole model) : -24849.07 LL(final, whole model) : -20791.24 Rho-square (0) : 0.1633 Adj.Rho-square (0) : 0.1627 AIC : 41610.47 BIC : 41721.12 LL(0,choice_best) : -13862.94 LL(final,choice_best) : -11091.56 LL(0,choice_worst) : -10986.12 LL(final,choice_worst) : -9699.672 Estimated parameters : 14 Time taken (hh:mm:ss) : 00:00:35.31 pre-estimation : 00:00:0.88 estimation : 00:00:17.27 post-estimation : 00:00:17.15 Iterations : 25 Min abs eigenvalue of Hessian : 119.3742 Estimates: Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0) b_brand_Artemis 0.000000 NA NA NA NA b_brand_Novum -0.298149 0.02725 -10.941 0.02734 -10.904 b_brand_BestValue -0.560417 0.05039 -11.121 0.05235 -10.706 b_brand_Supermarket -0.278069 0.05172 -5.376 0.05650 -4.921 b_brand_PainAway -1.166129 0.05164 -22.582 0.05430 -21.476 b_country_CH 0.605650 0.03511 17.249 0.03442 17.594 b_country_DK 0.294105 0.03359 8.757 0.03295 8.926 b_country_USA 0.000000 NA NA NA NA b_country_IND -0.242253 0.04377 -5.534 0.04480 -5.408 b_country_RUS -0.832384 0.04578 -18.181 0.04561 -18.250 b_country_BRA -0.582745 0.04504 -12.938 0.04625 -12.601 b_char_standard 0.000000 NA NA NA NA b_char_fast 0.719824 0.02438 29.525 0.02401 29.975 b_char_double 1.143807 0.03343 34.215 0.03211 35.626 b_risk -0.001523 4.516e-05 -33.717 4.511e-05 -33.758 b_price -0.716479 0.01580 -45.357 0.01478 -48.488 mu_worst 0.678903 0.01948 34.847 0.01931 35.152 Overview of choices for MNL model component best: alt1 alt2 alt3 alt4 Times available 10000.00 10000.00 10000.00 10000.00 Times chosen 3403.00 3546.00 1517.00 1534.00 Percentage chosen overall 34.03 35.46 15.17 15.34 Percentage chosen when available 34.03 35.46 15.17 15.34 Overview of choices for MNL model component worst: alt1 alt2 alt3 alt4 Times available 6597.00 6454.00 8483.00 8466.00 Times chosen 1531.00 1545.00 3482.00 3442.00 Percentage chosen overall 15.31 15.45 34.82 34.42 Percentage chosen when available 23.21 23.94 41.05 40.66 Classical covariance matrix: b_brand_Novum b_brand_BestValue b_brand_Supermarket b_brand_PainAway b_brand_Novum 7.4256e-04 3.8395e-04 4.4142e-04 4.0542e-04 b_brand_BestValue 3.8395e-04 0.002540 0.001898 0.001786 b_brand_Supermarket 4.4142e-04 0.001898 0.002675 0.001788 b_brand_PainAway 4.0542e-04 0.001786 0.001788 0.002667 b_country_CH -5.412e-05 5.5556e-04 5.8126e-04 4.5697e-04 b_country_DK -4.717e-05 5.2393e-04 5.6065e-04 4.7903e-04 b_country_IND -3.217e-05 -9.2711e-04 -9.6013e-04 -8.4266e-04 b_country_RUS -2.086e-05 -9.2231e-04 -9.8345e-04 -7.5238e-04 b_country_BRA 3.172e-07 -8.6317e-04 -0.001003 -7.9497e-04 b_char_fast 1.727e-06 2.317e-05 9.185e-05 -1.1336e-04 b_char_double 6.023e-05 3.2124e-04 3.9791e-04 1.8259e-04 b_risk 1.175e-08 -3.707e-07 -5.118e-07 6.289e-08 b_price 3.154e-05 2.3466e-04 1.9827e-04 3.1269e-04 mu_worst -4.175e-06 -4.824e-05 -1.2590e-04 1.6733e-04 b_country_CH b_country_DK b_country_IND b_country_RUS b_brand_Novum -5.412e-05 -4.717e-05 -3.217e-05 -2.086e-05 b_brand_BestValue 5.5556e-04 5.2393e-04 -9.2711e-04 -9.2231e-04 b_brand_Supermarket 5.8126e-04 5.6065e-04 -9.6013e-04 -9.8345e-04 b_brand_PainAway 4.5697e-04 4.7903e-04 -8.4266e-04 -7.5238e-04 b_country_CH 0.001233 5.7743e-04 -4.919e-05 -1.0690e-04 b_country_DK 5.7743e-04 0.001128 2.501e-05 -3.341e-05 b_country_IND -4.919e-05 2.501e-05 0.001916 9.8950e-04 b_country_RUS -1.0690e-04 -3.341e-05 9.8950e-04 0.002096 b_country_BRA -1.1311e-04 -5.558e-05 0.001004 0.001035 b_char_fast 9.978e-05 5.925e-05 -8.881e-05 -1.5908e-04 b_char_double 1.1565e-04 3.756e-05 -7.374e-05 -1.4505e-04 b_risk -1.805e-07 -1.043e-07 1.314e-07 3.725e-07 b_price -8.548e-05 -2.829e-05 5.092e-05 1.0546e-04 mu_worst -8.752e-05 -5.194e-05 9.340e-05 2.2542e-04 b_country_BRA b_char_fast b_char_double b_risk b_brand_Novum 3.172e-07 1.727e-06 6.023e-05 1.175e-08 b_brand_BestValue -8.6317e-04 2.317e-05 3.2124e-04 -3.707e-07 b_brand_Supermarket -0.001003 9.185e-05 3.9791e-04 -5.118e-07 b_brand_PainAway -7.9497e-04 -1.1336e-04 1.8259e-04 6.289e-08 b_country_CH -1.1311e-04 9.978e-05 1.1565e-04 -1.805e-07 b_country_DK -5.558e-05 5.925e-05 3.756e-05 -1.043e-07 b_country_IND 0.001004 -8.881e-05 -7.374e-05 1.314e-07 b_country_RUS 0.001035 -1.5908e-04 -1.4505e-04 3.725e-07 b_country_BRA 0.002029 -1.1740e-04 -1.2259e-04 1.905e-07 b_char_fast -1.1740e-04 5.9441e-04 3.5829e-04 -2.299e-07 b_char_double -1.2259e-04 3.5829e-04 0.001118 -2.551e-07 b_risk 1.905e-07 -2.299e-07 -2.551e-07 2.040e-09 b_price 1.0001e-04 -8.803e-05 -1.0833e-04 2.173e-07 mu_worst 1.4506e-04 -1.2939e-04 -1.3841e-04 4.839e-07 b_price mu_worst b_brand_Novum 3.154e-05 -4.175e-06 b_brand_BestValue 2.3466e-04 -4.824e-05 b_brand_Supermarket 1.9827e-04 -1.2590e-04 b_brand_PainAway 3.1269e-04 1.6733e-04 b_country_CH -8.548e-05 -8.752e-05 b_country_DK -2.829e-05 -5.194e-05 b_country_IND 5.092e-05 9.340e-05 b_country_RUS 1.0546e-04 2.2542e-04 b_country_BRA 1.0001e-04 1.4506e-04 b_char_fast -8.803e-05 -1.2939e-04 b_char_double -1.0833e-04 -1.3841e-04 b_risk 2.173e-07 4.839e-07 b_price 2.4952e-04 9.609e-05 mu_worst 9.609e-05 3.7956e-04 Robust covariance matrix: b_brand_Novum b_brand_BestValue b_brand_Supermarket b_brand_PainAway b_brand_Novum 7.4761e-04 3.2319e-04 4.1145e-04 3.6231e-04 b_brand_BestValue 3.2319e-04 0.002740 0.002202 0.002031 b_brand_Supermarket 4.1145e-04 0.002202 0.003193 0.002118 b_brand_PainAway 3.6231e-04 0.002031 0.002118 0.002949 b_country_CH -1.0771e-04 4.3285e-04 4.8595e-04 3.7756e-04 b_country_DK -6.845e-05 3.7544e-04 4.4603e-04 3.9491e-04 b_country_IND -7.841e-06 -9.6784e-04 -0.001020 -8.0073e-04 b_country_RUS 9.674e-06 -9.6937e-04 -0.001060 -7.7454e-04 b_country_BRA 6.120e-05 -9.4699e-04 -0.001115 -8.0835e-04 b_char_fast -4.448e-05 7.868e-06 1.0909e-04 -1.0475e-04 b_char_double -2.842e-06 2.2688e-04 3.5272e-04 1.1204e-04 b_risk 2.231e-08 -3.754e-07 -5.718e-07 -1.075e-08 b_price 4.214e-05 1.9834e-04 1.5059e-04 2.6345e-04 mu_worst 2.622e-05 -7.227e-05 -1.7334e-04 1.4406e-04 b_country_CH b_country_DK b_country_IND b_country_RUS b_brand_Novum -1.0771e-04 -6.845e-05 -7.841e-06 9.674e-06 b_brand_BestValue 4.3285e-04 3.7544e-04 -9.6784e-04 -9.6937e-04 b_brand_Supermarket 4.8595e-04 4.4603e-04 -0.001020 -0.001060 b_brand_PainAway 3.7756e-04 3.9491e-04 -8.0073e-04 -7.7454e-04 b_country_CH 0.001185 5.2894e-04 -4.914e-05 -1.4825e-04 b_country_DK 5.2894e-04 0.001086 2.243e-05 -3.601e-05 b_country_IND -4.914e-05 2.243e-05 0.002007 9.7365e-04 b_country_RUS -1.4825e-04 -3.601e-05 9.7365e-04 0.002080 b_country_BRA -1.2452e-04 -7.568e-05 0.001072 0.001153 b_char_fast 1.0106e-04 4.487e-05 -1.1964e-04 -2.2682e-04 b_char_double 9.091e-05 1.077e-05 -1.4773e-04 -1.9986e-04 b_risk -1.050e-07 -2.567e-08 2.032e-07 4.467e-07 b_price -7.026e-05 -2.252e-05 7.822e-05 1.2142e-04 mu_worst -9.992e-05 -7.020e-05 1.0948e-04 2.3427e-04 b_country_BRA b_char_fast b_char_double b_risk b_brand_Novum 6.120e-05 -4.448e-05 -2.842e-06 2.231e-08 b_brand_BestValue -9.4699e-04 7.868e-06 2.2688e-04 -3.754e-07 b_brand_Supermarket -0.001115 1.0909e-04 3.5272e-04 -5.718e-07 b_brand_PainAway -8.0835e-04 -1.0475e-04 1.1204e-04 -1.075e-08 b_country_CH -1.2452e-04 1.0106e-04 9.091e-05 -1.050e-07 b_country_DK -7.568e-05 4.487e-05 1.077e-05 -2.567e-08 b_country_IND 0.001072 -1.1964e-04 -1.4773e-04 2.032e-07 b_country_RUS 0.001153 -2.2682e-04 -1.9986e-04 4.467e-07 b_country_BRA 0.002139 -1.7459e-04 -2.1244e-04 2.679e-07 b_char_fast -1.7459e-04 5.7669e-04 3.4306e-04 -2.049e-07 b_char_double -2.1244e-04 3.4306e-04 0.001031 -1.799e-07 b_risk 2.679e-07 -2.049e-07 -1.799e-07 2.035e-09 b_price 1.1713e-04 -8.800e-05 -1.0160e-04 1.839e-07 mu_worst 1.8049e-04 -1.4636e-04 -1.2552e-04 4.984e-07 b_price mu_worst b_brand_Novum 4.214e-05 2.622e-05 b_brand_BestValue 1.9834e-04 -7.227e-05 b_brand_Supermarket 1.5059e-04 -1.7334e-04 b_brand_PainAway 2.6345e-04 1.4406e-04 b_country_CH -7.026e-05 -9.992e-05 b_country_DK -2.252e-05 -7.020e-05 b_country_IND 7.822e-05 1.0948e-04 b_country_RUS 1.2142e-04 2.3427e-04 b_country_BRA 1.1713e-04 1.8049e-04 b_char_fast -8.800e-05 -1.4636e-04 b_char_double -1.0160e-04 -1.2552e-04 b_risk 1.839e-07 4.984e-07 b_price 2.1835e-04 9.253e-05 mu_worst 9.253e-05 3.7300e-04 Classical correlation matrix: b_brand_Novum b_brand_BestValue b_brand_Supermarket b_brand_PainAway b_brand_Novum 1.000000 0.27959 0.31318 0.28810 b_brand_BestValue 0.279594 1.00000 0.72813 0.68613 b_brand_Supermarket 0.313183 0.72813 1.00000 0.66957 b_brand_PainAway 0.288104 0.68613 0.66957 1.00000 b_country_CH -0.056564 0.31398 0.32006 0.25203 b_country_DK -0.051537 0.30956 0.32274 0.27620 b_country_IND -0.026973 -0.42029 -0.42407 -0.37278 b_country_RUS -0.016723 -0.39976 -0.41530 -0.31823 b_country_BRA 2.5845e-04 -0.38027 -0.43052 -0.34177 b_char_fast 0.002599 0.01886 0.07284 -0.09004 b_char_double 0.066120 0.19068 0.23012 0.10577 b_risk 0.009547 -0.16289 -0.21908 0.02696 b_price 0.073265 0.29478 0.24267 0.38332 mu_worst -0.007865 -0.04914 -0.12494 0.16631 b_country_CH b_country_DK b_country_IND b_country_RUS b_brand_Novum -0.05656 -0.05154 -0.02697 -0.01672 b_brand_BestValue 0.31398 0.30956 -0.42029 -0.39976 b_brand_Supermarket 0.32006 0.32274 -0.42407 -0.41530 b_brand_PainAway 0.25203 0.27620 -0.37278 -0.31823 b_country_CH 1.00000 0.48966 -0.03201 -0.06650 b_country_DK 0.48966 1.00000 0.01701 -0.02173 b_country_IND -0.03201 0.01701 1.00000 0.49375 b_country_RUS -0.06650 -0.02173 0.49375 1.00000 b_country_BRA -0.07152 -0.03674 0.50929 0.50194 b_char_fast 0.11656 0.07236 -0.08322 -0.14252 b_char_double 0.09853 0.03345 -0.05039 -0.09477 b_risk -0.11384 -0.06877 0.06647 0.18014 b_price -0.15412 -0.05333 0.07365 0.14582 mu_worst -0.12795 -0.07938 0.10952 0.25273 b_country_BRA b_char_fast b_char_double b_risk b_brand_Novum 2.5845e-04 0.002599 0.06612 0.009547 b_brand_BestValue -0.38027 0.018860 0.19068 -0.162886 b_brand_Supermarket -0.43052 0.072840 0.23012 -0.219077 b_brand_PainAway -0.34177 -0.090041 0.10577 0.026964 b_country_CH -0.07152 0.116561 0.09853 -0.113841 b_country_DK -0.03674 0.072363 0.03345 -0.068770 b_country_IND 0.50929 -0.083216 -0.05039 0.066469 b_country_RUS 0.50194 -0.142519 -0.09477 0.180138 b_country_BRA 1.00000 -0.106903 -0.08141 0.093643 b_char_fast -0.10690 1.000000 0.43960 -0.208760 b_char_double -0.08141 0.439603 1.00000 -0.168987 b_risk 0.09364 -0.208760 -0.16899 1.000000 b_price 0.14056 -0.228589 -0.20514 0.304572 mu_worst 0.16530 -0.272412 -0.21251 0.549967 b_price mu_worst b_brand_Novum 0.07326 -0.007865 b_brand_BestValue 0.29478 -0.049140 b_brand_Supermarket 0.24267 -0.124936 b_brand_PainAway 0.38332 0.166314 b_country_CH -0.15412 -0.127950 b_country_DK -0.05333 -0.079377 b_country_IND 0.07365 0.109517 b_country_RUS 0.14582 0.252726 b_country_BRA 0.14056 0.165303 b_char_fast -0.22859 -0.272412 b_char_double -0.20514 -0.212513 b_risk 0.30457 0.549967 b_price 1.00000 0.312239 mu_worst 0.31224 1.000000 Robust correlation matrix: b_brand_Novum b_brand_BestValue b_brand_Supermarket b_brand_PainAway b_brand_Novum 1.000000 0.225813 0.26632 0.244031 b_brand_BestValue 0.225813 1.000000 0.74462 0.714606 b_brand_Supermarket 0.266325 0.744621 1.00000 0.690311 b_brand_PainAway 0.244031 0.714606 0.69031 1.000000 b_country_CH -0.114431 0.240213 0.24984 0.201985 b_country_DK -0.075971 0.217666 0.23957 0.220712 b_country_IND -0.006401 -0.412719 -0.40302 -0.329166 b_country_RUS 0.007757 -0.406027 -0.41138 -0.312742 b_country_BRA 0.048399 -0.391200 -0.42671 -0.321908 b_char_fast -0.067748 0.006259 0.08040 -0.080330 b_char_double -0.003237 0.135003 0.19444 0.064267 b_risk 0.018089 -0.158980 -0.22435 -0.004390 b_price 0.104303 0.256419 0.18036 0.328336 mu_worst 0.049649 -0.071490 -0.15885 0.137364 b_country_CH b_country_DK b_country_IND b_country_RUS b_brand_Novum -0.11443 -0.07597 -0.006401 0.007757 b_brand_BestValue 0.24021 0.21767 -0.412719 -0.406027 b_brand_Supermarket 0.24984 0.23957 -0.403024 -0.411381 b_brand_PainAway 0.20199 0.22071 -0.329166 -0.312742 b_country_CH 1.00000 0.46630 -0.031865 -0.094421 b_country_DK 0.46630 1.00000 0.015194 -0.023958 b_country_IND -0.03186 0.01519 1.000000 0.476510 b_country_RUS -0.09442 -0.02396 0.476510 1.000000 b_country_BRA -0.07822 -0.04966 0.517297 0.546823 b_char_fast 0.12225 0.05671 -0.111211 -0.207085 b_char_double 0.08226 0.01018 -0.102711 -0.136486 b_risk -0.06759 -0.01727 0.100562 0.217122 b_price -0.13812 -0.04625 0.118154 0.180166 mu_worst -0.15029 -0.11032 0.126536 0.265956 b_country_BRA b_char_fast b_char_double b_risk b_brand_Novum 0.04840 -0.067748 -0.003237 0.018089 b_brand_BestValue -0.39120 0.006259 0.135003 -0.158980 b_brand_Supermarket -0.42671 0.080398 0.194439 -0.224348 b_brand_PainAway -0.32191 -0.080330 0.064267 -0.004390 b_country_CH -0.07822 0.122249 0.082257 -0.067593 b_country_DK -0.04966 0.056705 0.010176 -0.017271 b_country_IND 0.51730 -0.111211 -0.102711 0.100562 b_country_RUS 0.54682 -0.207085 -0.136486 0.217122 b_country_BRA 1.00000 -0.157212 -0.143081 0.128443 b_char_fast -0.15721 1.000000 0.444952 -0.189180 b_char_double -0.14308 0.444952 1.000000 -0.124199 b_risk 0.12844 -0.189180 -0.124199 1.000000 b_price 0.17140 -0.248000 -0.214162 0.275837 mu_worst 0.20208 -0.315571 -0.202423 0.572051 b_price mu_worst b_brand_Novum 0.10430 0.04965 b_brand_BestValue 0.25642 -0.07149 b_brand_Supermarket 0.18036 -0.15885 b_brand_PainAway 0.32834 0.13736 b_country_CH -0.13812 -0.15029 b_country_DK -0.04625 -0.11032 b_country_IND 0.11815 0.12654 b_country_RUS 0.18017 0.26596 b_country_BRA 0.17140 0.20208 b_char_fast -0.24800 -0.31557 b_char_double -0.21416 -0.20242 b_risk 0.27584 0.57205 b_price 1.00000 0.32424 mu_worst 0.32424 1.00000 20 worst outliers in terms of lowest average per choice prediction: ID Avg prob per choice 593 0.04488482 875 0.04646779 367 0.04759511 859 0.05482618 947 0.05738831 476 0.05911229 70 0.06101147 499 0.06154961 933 0.06219314 8 0.06279261 288 0.06285863 240 0.06337164 678 0.06355876 824 0.06381937 287 0.06390639 584 0.06414833 163 0.06423122 326 0.06424429 524 0.06438134 1000 0.06439288 Changes in parameter estimates from starting values: Initial Estimate Difference b_brand_Artemis 0.000 0.000000 0.000000 b_brand_Novum 0.000 -0.298149 -0.298149 b_brand_BestValue 0.000 -0.560417 -0.560417 b_brand_Supermarket 0.000 -0.278069 -0.278069 b_brand_PainAway 0.000 -1.166129 -1.166129 b_country_CH 0.000 0.605650 0.605650 b_country_DK 0.000 0.294105 0.294105 b_country_USA 0.000 0.000000 0.000000 b_country_IND 0.000 -0.242253 -0.242253 b_country_RUS 0.000 -0.832384 -0.832384 b_country_BRA 0.000 -0.582745 -0.582745 b_char_standard 0.000 0.000000 0.000000 b_char_fast 0.000 0.719824 0.719824 b_char_double 0.000 1.143807 1.143807 b_risk 0.000 -0.001523 -0.001523 b_price 0.000 -0.716479 -0.716479 mu_worst 1.000 0.678903 -0.321097 Settings and functions used in model definition: apollo_control -------------- Value modelName "Apollo_example_23" modelDescr "Best-worst model on drug choice data" indivID "ID" debug "FALSE" nCores "1" workInLogs "FALSE" seed "13" mixing "FALSE" HB "FALSE" noValidation "FALSE" noDiagnostics "FALSE" panelData "TRUE" analyticGrad "TRUE" Hessian routines attempted -------------- numerical second derivative of LL (using numDeriv) Scaling used in computing Hessian -------------- Value b_brand_Novum 0.298148941 b_brand_BestValue 0.560417070 b_brand_Supermarket 0.278069355 b_brand_PainAway 1.166129486 b_country_CH 0.605650114 b_country_DK 0.294104802 b_country_IND 0.242253455 b_country_RUS 0.832384449 b_country_BRA 0.582744660 b_char_fast 0.719823892 b_char_double 1.143806749 b_risk 0.001522766 b_price 0.716478796 mu_worst 0.678903350 apollo_probabilities -------------------- function(apollo_beta, apollo_inputs, functionality="estimate"){ ### 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_brand_Artemis*(brand_1=="Artemis") + b_brand_Novum*(brand_1=="Novum") + b_country_CH*(country_1=="Switzerland") + b_country_DK*(country_1=="Denmark") + b_country_USA*(country_1=="USA") + b_char_standard*(char_1=="standard") + b_char_fast*(char_1=="fast acting") + b_char_double*(char_1=="double strength") + b_risk*side_effects_1 + b_price*price_1) V[['alt2']] = ( b_brand_Artemis*(brand_2=="Artemis") + b_brand_Novum*(brand_2=="Novum") + b_country_CH*(country_2=="Switzerland") + b_country_DK*(country_2=="Denmark") + b_country_USA*(country_2=="USA") + b_char_standard*(char_2=="standard") + b_char_fast*(char_2=="fast acting") + b_char_double*(char_2=="double strength") + b_risk*side_effects_2 + b_price*price_2) V[['alt3']] = ( b_brand_BestValue*(brand_3=="BestValue") + b_brand_Supermarket*(brand_3=="Supermarket") + b_brand_PainAway*(brand_3=="PainAway") + b_country_USA*(country_3=="USA") + b_country_IND*(country_3=="India") + b_country_RUS*(country_3=="Russia") + b_country_BRA*(country_3=="Brazil") + b_char_standard*(char_3=="standard") + b_char_fast*(char_3=="fast acting") + b_risk*side_effects_3 + b_price*price_3 ) V[['alt4']] = ( b_brand_BestValue*(brand_4=="BestValue") + b_brand_Supermarket*(brand_4=="Supermarket") + b_brand_PainAway*(brand_4=="PainAway") + b_country_USA*(country_4=="USA") + b_country_IND*(country_4=="India") + b_country_RUS*(country_4=="Russia") + b_country_BRA*(country_4=="Brazil") + b_char_standard*(char_4=="standard") + b_char_fast*(char_4=="fast acting") + b_risk*side_effects_4 + b_price*price_4 ) ### Compute probabilities for 'best' choice using MNL model mnl_settings = list( alternatives = c(alt1=1, alt2=2, alt3=3, alt4=4), avail = list(alt1=1, alt2=1, alt3=1, alt4=1), choiceVar = best, V = V, componentName = "best" ) P[['choice_best']] = apollo_mnl(mnl_settings, functionality) ### Compute probabilities for 'worst' choice using MNL model mnl_settings$avail = list(alt1=(best!=1), alt2=(best!=2), alt3=(best!=3), alt4=(best!=4)) mnl_settings$choiceVar = worst mnl_settings$V = lapply(V,"*",-mu_worst) mnl_settings$componentName = "worst" P[['choice_worst']] = apollo_mnl(mnl_settings, functionality) ### Combined model P = apollo_combineModels(P, apollo_inputs, functionality) ### Take product across observation for same individual P = apollo_panelProd(P, apollo_inputs, functionality) ### Prepare and return outputs of function P = apollo_prepareProb(P, apollo_inputs, functionality) return(P)