Model run by stephane.hess using Apollo 0.2.9 on R 4.0.5 for Darwin. www.ApolloChoiceModelling.com Model name : BW_joint_model Model description : Best-worst model on drug choice data Model run at : 2023-05-10 22:05:43 Estimation method : bfgs Model diagnosis : successful convergence Optimisation diagnosis : Maximum found hessian properties : Negative definitive maximum eigenvalue : -119.375019 Number of individuals : 1000 Number of rows in database : 10000 Number of modelled outcomes : 20000 best : 10000 choice_worst : 10000 Number of cores used : 1 Model without mixing LL(start) : -24849.07 LL (whole model) at equal shares, LL(0) : -24849.07 LL (whole model) at observed shares, LL(C) : -26184.18 LL(final, whole model) : -20791.24 Rho-squared vs equal shares : 0.1633 Adj.Rho-squared vs equal shares : 0.1627 Rho-squared vs observed shares : 0.206 Adj.Rho-squared vs observed shares : 0.2057 AIC : 41610.47 BIC : 41711.42 LL(0,choice_best) : -13862.94 LL(final,choice_best) : -11091.56 LL(0,choice_worst) : -10986.12 LL(final,choice_worst) : -9699.67 Estimated parameters : 14 Time taken (hh:mm:ss) : 00:00:17.31 pre-estimation : 00:00:4.04 estimation : 00:00:4.2 initial estimation : 00:00:3.86 estimation after rescaling : 00:00:0.34 post-estimation : 00:00:9.07 Iterations : 26 initial estimation : 25 estimation after rescaling : 1 Unconstrained optimisation. 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.560419 0.05039 -11.121 0.05235 -10.706 b_brand_Supermarket -0.278070 0.05172 -5.376 0.05650 -4.921 b_brand_PainAway -1.166139 0.05164 -22.582 0.05430 -21.476 b_country_CH 0.605654 0.03511 17.250 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.242254 0.04377 -5.534 0.04480 -5.408 b_country_RUS -0.832391 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.719828 0.02438 29.525 0.02401 29.975 b_char_double 1.143827 0.03343 34.216 0.03211 35.626 b_risk -0.001523 4.516e-05 -33.716 4.511e-05 -33.758 b_price -0.716470 0.01580 -45.357 0.01478 -48.487 mu_worst 0.678917 0.01948 34.847 0.01931 35.151 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 choice_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.5555e-04 5.8125e-04 4.5696e-04 b_country_DK -4.717e-05 5.2392e-04 5.6065e-04 4.7902e-04 b_country_IND -3.217e-05 -9.2710e-04 -9.6013e-04 -8.4265e-04 b_country_RUS -2.086e-05 -9.2231e-04 -9.8346e-04 -7.5236e-04 b_country_BRA 3.173e-07 -8.6316e-04 -0.001003 -7.9496e-04 b_char_fast 1.727e-06 2.317e-05 9.186e-05 -1.1337e-04 b_char_double 6.023e-05 3.2123e-04 3.9791e-04 1.8258e-04 b_risk 1.175e-08 -3.707e-07 -5.118e-07 6.292e-08 b_price 3.154e-05 2.3466e-04 1.9826e-04 3.1269e-04 mu_worst -4.176e-06 -4.825e-05 -1.2591e-04 1.6734e-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.5555e-04 5.2392e-04 -9.2710e-04 -9.2231e-04 b_brand_Supermarket 5.8125e-04 5.6065e-04 -9.6013e-04 -9.8346e-04 b_brand_PainAway 4.5696e-04 4.7902e-04 -8.4265e-04 -7.5236e-04 b_country_CH 0.001233 5.7742e-04 -4.920e-05 -1.0691e-04 b_country_DK 5.7742e-04 0.001128 2.500e-05 -3.342e-05 b_country_IND -4.920e-05 2.500e-05 0.001916 9.8950e-04 b_country_RUS -1.0691e-04 -3.342e-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.926e-05 -8.881e-05 -1.5909e-04 b_char_double 1.1565e-04 3.756e-05 -7.374e-05 -1.4506e-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.753e-05 -5.194e-05 9.340e-05 2.2544e-04 b_country_BRA b_char_fast b_char_double b_risk b_brand_Novum 3.173e-07 1.727e-06 6.023e-05 1.175e-08 b_brand_BestValue -8.6316e-04 2.317e-05 3.2123e-04 -3.707e-07 b_brand_Supermarket -0.001003 9.186e-05 3.9791e-04 -5.118e-07 b_brand_PainAway -7.9496e-04 -1.1337e-04 1.8258e-04 6.292e-08 b_country_CH -1.1311e-04 9.978e-05 1.1565e-04 -1.805e-07 b_country_DK -5.558e-05 5.926e-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.5909e-04 -1.4506e-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.5830e-04 -2.299e-07 b_char_double -1.2259e-04 3.5830e-04 0.001118 -2.552e-07 b_risk 1.905e-07 -2.299e-07 -2.552e-07 2.040e-09 b_price 1.0001e-04 -8.804e-05 -1.0833e-04 2.173e-07 mu_worst 1.4507e-04 -1.2940e-04 -1.3842e-04 4.839e-07 b_price mu_worst b_brand_Novum 3.154e-05 -4.176e-06 b_brand_BestValue 2.3466e-04 -4.825e-05 b_brand_Supermarket 1.9826e-04 -1.2591e-04 b_brand_PainAway 3.1269e-04 1.6734e-04 b_country_CH -8.548e-05 -8.753e-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.2544e-04 b_country_BRA 1.0001e-04 1.4507e-04 b_char_fast -8.804e-05 -1.2940e-04 b_char_double -1.0833e-04 -1.3842e-04 b_risk 2.173e-07 4.839e-07 b_price 2.4952e-04 9.610e-05 mu_worst 9.610e-05 3.7958e-04 Robust covariance matrix: b_brand_Novum b_brand_BestValue b_brand_Supermarket b_brand_PainAway b_brand_Novum 7.4760e-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.8596e-04 3.7754e-04 b_country_DK -6.845e-05 3.7544e-04 4.4603e-04 3.9490e-04 b_country_IND -7.839e-06 -9.6784e-04 -0.001020 -8.0072e-04 b_country_RUS 9.677e-06 -9.6937e-04 -0.001060 -7.7451e-04 b_country_BRA 6.120e-05 -9.4699e-04 -0.001115 -8.0833e-04 b_char_fast -4.448e-05 7.869e-06 1.0910e-04 -1.0477e-04 b_char_double -2.843e-06 2.2688e-04 3.5273e-04 1.1202e-04 b_risk 2.231e-08 -3.754e-07 -5.718e-07 -1.070e-08 b_price 4.214e-05 1.9834e-04 1.5058e-04 2.6345e-04 mu_worst 2.622e-05 -7.228e-05 -1.7336e-04 1.4409e-04 b_country_CH b_country_DK b_country_IND b_country_RUS b_brand_Novum -1.0771e-04 -6.845e-05 -7.839e-06 9.677e-06 b_brand_BestValue 4.3285e-04 3.7544e-04 -9.6784e-04 -9.6937e-04 b_brand_Supermarket 4.8596e-04 4.4603e-04 -0.001020 -0.001060 b_brand_PainAway 3.7754e-04 3.9490e-04 -8.0072e-04 -7.7451e-04 b_country_CH 0.001185 5.2894e-04 -4.915e-05 -1.4826e-04 b_country_DK 5.2894e-04 0.001086 2.242e-05 -3.602e-05 b_country_IND -4.915e-05 2.242e-05 0.002007 9.7366e-04 b_country_RUS -1.4826e-04 -3.602e-05 9.7366e-04 0.002080 b_country_BRA -1.2453e-04 -7.568e-05 0.001072 0.001153 b_char_fast 1.0107e-04 4.488e-05 -1.1965e-04 -2.2684e-04 b_char_double 9.092e-05 1.077e-05 -1.4774e-04 -1.9988e-04 b_risk -1.050e-07 -2.568e-08 2.032e-07 4.468e-07 b_price -7.026e-05 -2.252e-05 7.822e-05 1.2143e-04 mu_worst -9.994e-05 -7.021e-05 1.0950e-04 2.3432e-04 b_country_BRA b_char_fast b_char_double b_risk b_brand_Novum 6.120e-05 -4.448e-05 -2.843e-06 2.231e-08 b_brand_BestValue -9.4699e-04 7.869e-06 2.2688e-04 -3.754e-07 b_brand_Supermarket -0.001115 1.0910e-04 3.5273e-04 -5.718e-07 b_brand_PainAway -8.0833e-04 -1.0477e-04 1.1202e-04 -1.070e-08 b_country_CH -1.2453e-04 1.0107e-04 9.092e-05 -1.050e-07 b_country_DK -7.568e-05 4.488e-05 1.077e-05 -2.568e-08 b_country_IND 0.001072 -1.1965e-04 -1.4774e-04 2.032e-07 b_country_RUS 0.001153 -2.2684e-04 -1.9988e-04 4.468e-07 b_country_BRA 0.002139 -1.7460e-04 -2.1245e-04 2.680e-07 b_char_fast -1.7460e-04 5.7670e-04 3.4307e-04 -2.050e-07 b_char_double -2.1245e-04 3.4307e-04 0.001031 -1.799e-07 b_risk 2.680e-07 -2.050e-07 -1.799e-07 2.035e-09 b_price 1.1713e-04 -8.801e-05 -1.0161e-04 1.839e-07 mu_worst 1.8052e-04 -1.4638e-04 -1.2554e-04 4.984e-07 b_price mu_worst b_brand_Novum 4.214e-05 2.622e-05 b_brand_BestValue 1.9834e-04 -7.228e-05 b_brand_Supermarket 1.5058e-04 -1.7336e-04 b_brand_PainAway 2.6345e-04 1.4409e-04 b_country_CH -7.026e-05 -9.994e-05 b_country_DK -2.252e-05 -7.021e-05 b_country_IND 7.822e-05 1.0950e-04 b_country_RUS 1.2143e-04 2.3432e-04 b_country_BRA 1.1713e-04 1.8052e-04 b_char_fast -8.801e-05 -1.4638e-04 b_char_double -1.0161e-04 -1.2554e-04 b_risk 1.839e-07 4.984e-07 b_price 2.1835e-04 9.254e-05 mu_worst 9.254e-05 3.7305e-04 Classical correlation matrix: b_brand_Novum b_brand_BestValue b_brand_Supermarket b_brand_PainAway b_brand_Novum 1.000000 0.27960 0.31318 0.28810 b_brand_BestValue 0.279595 1.00000 0.72813 0.68613 b_brand_Supermarket 0.313183 0.72813 1.00000 0.66957 b_brand_PainAway 0.288103 0.68613 0.66957 1.00000 b_country_CH -0.056563 0.31398 0.32006 0.25202 b_country_DK -0.051536 0.30956 0.32274 0.27620 b_country_IND -0.026973 -0.42029 -0.42407 -0.37278 b_country_RUS -0.016722 -0.39976 -0.41530 -0.31822 b_country_BRA 2.5850e-04 -0.38027 -0.43053 -0.34177 b_char_fast 0.002599 0.01886 0.07284 -0.09005 b_char_double 0.066120 0.19068 0.23013 0.10576 b_risk 0.009546 -0.16289 -0.21908 0.02698 b_price 0.073265 0.29478 0.24266 0.38333 mu_worst -0.007865 -0.04914 -0.12494 0.16633 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.25202 0.27620 -0.37278 -0.31822 b_country_CH 1.00000 0.48966 -0.03201 -0.06651 b_country_DK 0.48966 1.00000 0.01701 -0.02173 b_country_IND -0.03201 0.01701 1.00000 0.49376 b_country_RUS -0.06651 -0.02173 0.49376 1.00000 b_country_BRA -0.07152 -0.03674 0.50929 0.50195 b_char_fast 0.11657 0.07237 -0.08322 -0.14253 b_char_double 0.09853 0.03345 -0.05039 -0.09478 b_risk -0.11385 -0.06877 0.06647 0.18015 b_price -0.15413 -0.05333 0.07365 0.14583 mu_worst -0.12796 -0.07938 0.10952 0.25275 b_country_BRA b_char_fast b_char_double b_risk b_brand_Novum 2.5850e-04 0.002599 0.06612 0.009546 b_brand_BestValue -0.38027 0.018862 0.19068 -0.162886 b_brand_Supermarket -0.43053 0.072844 0.23013 -0.219082 b_brand_PainAway -0.34177 -0.090048 0.10576 0.026976 b_country_CH -0.07152 0.116566 0.09853 -0.113847 b_country_DK -0.03674 0.072366 0.03345 -0.068773 b_country_IND 0.50929 -0.083219 -0.05039 0.066474 b_country_RUS 0.50195 -0.142529 -0.09478 0.180153 b_country_BRA 1.00000 -0.106908 -0.08142 0.093652 b_char_fast -0.10691 1.000000 0.43961 -0.208774 b_char_double -0.08142 0.439608 1.00000 -0.168998 b_risk 0.09365 -0.208774 -0.16900 1.000000 b_price 0.14056 -0.228595 -0.20514 0.304579 mu_worst 0.16531 -0.272429 -0.21253 0.549986 b_price mu_worst b_brand_Novum 0.07327 -0.007865 b_brand_BestValue 0.29478 -0.049142 b_brand_Supermarket 0.24266 -0.124944 b_brand_PainAway 0.38333 0.166327 b_country_CH -0.15413 -0.127958 b_country_DK -0.05333 -0.079381 b_country_IND 0.07365 0.109523 b_country_RUS 0.14583 0.252746 b_country_BRA 0.14056 0.165313 b_char_fast -0.22859 -0.272429 b_char_double -0.20514 -0.212526 b_risk 0.30458 0.549986 b_price 1.00000 0.312245 mu_worst 0.31225 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.244030 b_brand_BestValue 0.225813 1.000000 0.74462 0.714603 b_brand_Supermarket 0.266324 0.744622 1.00000 0.690303 b_brand_PainAway 0.244030 0.714603 0.69030 1.000000 b_country_CH -0.114432 0.240211 0.24984 0.201976 b_country_DK -0.075971 0.217667 0.23957 0.220707 b_country_IND -0.006399 -0.412718 -0.40302 -0.329160 b_country_RUS 0.007759 -0.406024 -0.41138 -0.312724 b_country_BRA 0.048400 -0.391199 -0.42671 -0.321898 b_char_fast -0.067748 0.006260 0.08040 -0.080344 b_char_double -0.003238 0.135000 0.19444 0.064253 b_risk 0.018087 -0.158980 -0.22436 -0.004368 b_price 0.104303 0.256420 0.18036 0.328344 mu_worst 0.049647 -0.071489 -0.15886 0.137390 b_country_CH b_country_DK b_country_IND b_country_RUS b_brand_Novum -0.11443 -0.07597 -0.006399 0.007759 b_brand_BestValue 0.24021 0.21767 -0.412718 -0.406024 b_brand_Supermarket 0.24984 0.23957 -0.403025 -0.411382 b_brand_PainAway 0.20198 0.22071 -0.329160 -0.312724 b_country_CH 1.00000 0.46631 -0.031868 -0.094429 b_country_DK 0.46631 1.00000 0.015190 -0.023964 b_country_IND -0.03187 0.01519 1.000000 0.476513 b_country_RUS -0.09443 -0.02396 0.476513 1.000000 b_country_BRA -0.07823 -0.04967 0.517300 0.546828 b_char_fast 0.12226 0.05671 -0.111217 -0.207103 b_char_double 0.08227 0.01018 -0.102718 -0.136499 b_risk -0.06761 -0.01728 0.100570 0.217148 b_price -0.13813 -0.04625 0.118158 0.180179 mu_worst -0.15031 -0.11032 0.126548 0.265990 b_country_BRA b_char_fast b_char_double b_risk b_brand_Novum 0.04840 -0.067748 -0.003238 0.018087 b_brand_BestValue -0.39120 0.006260 0.135000 -0.158980 b_brand_Supermarket -0.42671 0.080402 0.194439 -0.224356 b_brand_PainAway -0.32190 -0.080344 0.064253 -0.004368 b_country_CH -0.07823 0.122258 0.082266 -0.067606 b_country_DK -0.04967 0.056712 0.010181 -0.017280 b_country_IND 0.51730 -0.111217 -0.102718 0.100570 b_country_RUS 0.54683 -0.207103 -0.136499 0.217148 b_country_BRA 1.00000 -0.157221 -0.143088 0.128459 b_char_fast -0.15722 1.000000 0.444960 -0.189204 b_char_double -0.14309 0.444960 1.000000 -0.124218 b_risk 0.12846 -0.189204 -0.124218 1.000000 b_price 0.17141 -0.248010 -0.214173 0.275849 mu_worst 0.20210 -0.315596 -0.202444 0.572083 b_price mu_worst b_brand_Novum 0.10430 0.04965 b_brand_BestValue 0.25642 -0.07149 b_brand_Supermarket 0.18036 -0.15886 b_brand_PainAway 0.32834 0.13739 b_country_CH -0.13813 -0.15031 b_country_DK -0.04625 -0.11032 b_country_IND 0.11816 0.12655 b_country_RUS 0.18018 0.26599 b_country_BRA 0.17141 0.20210 b_char_fast -0.24801 -0.31560 b_char_double -0.21417 -0.20244 b_risk 0.27585 0.57208 b_price 1.00000 0.32425 mu_worst 0.32425 1.00000 20 worst outliers in terms of lowest average per choice prediction: ID Avg prob per choice 593 0.04488395 875 0.04646724 367 0.04759334 859 0.05482459 947 0.05738798 476 0.05911192 70 0.06101001 499 0.06154781 933 0.06219214 8 0.06279192 288 0.06285867 240 0.06337052 678 0.06355753 824 0.06381848 287 0.06390563 584 0.06414756 163 0.06423045 326 0.06424316 524 0.06438067 1000 0.06439122 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.560419 -0.560419 b_brand_Supermarket 0.000 -0.278070 -0.278070 b_brand_PainAway 0.000 -1.166139 -1.166139 b_country_CH 0.000 0.605654 0.605654 b_country_DK 0.000 0.294105 0.294105 b_country_USA 0.000 0.000000 0.000000 b_country_IND 0.000 -0.242254 -0.242254 b_country_RUS 0.000 -0.832391 -0.832391 b_country_BRA 0.000 -0.582745 -0.582745 b_char_standard 0.000 0.000000 0.000000 b_char_fast 0.000 0.719828 0.719828 b_char_double 0.000 1.143827 1.143827 b_risk 0.000 -0.001523 -0.001523 b_price 0.000 -0.716470 -0.716470 mu_worst 1.000 0.678917 -0.321083 Settings and functions used in model definition: apollo_control -------------- Value modelName "BW_joint_model" modelDescr "Best-worst model on drug choice data" indivID "ID" outputDirectory "output/" debug "FALSE" nCores "1" workInLogs "FALSE" seed "13" mixing "FALSE" 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 b_brand_Novum 0.298148946 b_brand_BestValue 0.560417031 b_brand_Supermarket 0.278069338 b_brand_PainAway 1.166129380 b_country_CH 0.605650096 b_country_DK 0.294104798 b_country_IND 0.242253439 b_country_RUS 0.832384377 b_country_BRA 0.582744628 b_char_fast 0.719823854 b_char_double 1.143806703 b_risk 0.001522766 b_price 0.716478761 mu_worst 0.678903318 Scaling used in computing Hessian --------------------------------- Value b_brand_Novum 0.298148794 b_brand_BestValue 0.560418556 b_brand_Supermarket 0.278069653 b_brand_PainAway 1.166138571 b_country_CH 0.605654017 b_country_DK 0.294105442 b_country_IND 0.242253999 b_country_RUS 0.832390699 b_country_BRA 0.582744730 b_char_fast 0.719827889 b_char_double 1.143827140 b_risk 0.001522756 b_price 0.716469783 mu_worst 0.678916646 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_best = list( alternatives = c(alt1=1, alt2=2, alt3=3, alt4=4), avail = list(alt1=1, alt2=1, alt3=1, alt4=1), choiceVar = best, utilities = V, componentName = "best" ) P[["choice_best"]] = apollo_mnl(mnl_settings_best, functionality) ### Compute probabilities for "worst" choice using MNL model mnl_settings_worst = list( alternatives = c(alt1=1, alt2=2, alt3=3, alt4=4), avail = list(alt1=(best!=1), alt2=(best!=2), alt3=(best!=3), alt4=(best!=4)), choiceVar = worst, utilities = list(alt1 = -mu_worst*V[["alt1"]], alt2 = -mu_worst*V[["alt2"]], alt3 = -mu_worst*V[["alt3"]], alt4 = -mu_worst*V[["alt4"]]) ) P[["choice_worst"]] = apollo_mnl(mnl_settings_worst, 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) }