Model run by stephane.hess using Apollo 0.2.9 on R 4.0.5 for Darwin. www.ApolloChoiceModelling.com Model name : Hybrid_with_OL_and_MMNL_bayesian Model description : Hybrid choice model on drug choice data, bayesian estimation Model run at : 2023-05-11 22:56:22 Estimation method : Hierarchical Bayes Number of individuals : 1000 Number of rows in database : 10000 Number of modelled outcomes : 14000 choice : 10000 indic_quality : 1000 indic_ingredients : 1000 indic_patent : 1000 indic_dominance : 1000 Number of cores used : 1 Estimation carried out using RSGHB Burn-in iterations : 20000 Post burn-in iterations : 10000 Classical model fit statistics were calculated at parameter values obtained using averaging across the post burn-in iterations. LL(start) : -19973.99 LL (whole model) at equal shares, LL(0) : -20300.7 LL (whole model) at observed shares, LL(C) : -19050.2 LL(final, whole model) : -17022.34 Rho-squared vs equal shares : Not applicable Adj.Rho-squared vs equal shares : Not applicable Rho-squared vs observed shares : Not applicable Adj.Rho-squared vs observed shares : Not applicable AIC : 34134.68 BIC : 34459.15 Equiv. estimated parameters : 45 (non-random parameters : 41) (means of random parameters : 2) (covariance matrix terms : 2) LL(0,choice) : -13862.94 LL(final,choice) : -11343.1 LL(0,indic_quality) : -1609.44 LL(final,indic_quality) : -1456.09 LL(0,indic_ingredients) : -1609.44 LL(final,indic_ingredients) : -1488.06 LL(0,indic_patent) : -1609.44 LL(final,indic_patent) : -1488.97 LL(0,indic_dominance) : -1609.44 LL(final,indic_dominance) : -1431.42 Time taken (hh:mm:ss) : 00:19:50.92 pre-estimation : 00:00:2.3 estimation : 00:19:39.16 post-estimation : 00:00:9.46 Summary of parameter chains Non-random coefficients These outputs have had the scaling used in estimation applied to them Mean SD gamma_Artemis_reg_user -0.0155 0.0076 gamma_Artemis_university -0.0331 0.0053 gamma_Artemis_age_50 -0.0091 0.0042 gamma_Novum_reg_user -0.0267 0.0029 gamma_Novum_university 0.0087 0.0059 gamma_Novum_age_50 -0.0275 0.0036 b_brand_BestValue 0.6955 0.0355 b_brand_Supermarket 0.9945 0.0160 b_brand_PainAway 0.0000 NA b_country_CH 0.7051 0.0302 b_country_DK 0.3714 0.0278 b_country_USA 0.0000 NA b_country_IND -0.2912 0.0499 b_country_RUS -0.8463 0.0658 b_country_BRA -0.6304 0.0472 b_char_standard 0.0000 NA b_char_fast 0.7770 0.0338 b_char_double 1.2154 0.0453 b_risk -0.0016 0.0001 b_price -0.7374 0.0195 gamma_LV_reg_user -0.7444 0.0313 gamma_LV_university -0.5185 0.0378 gamma_LV_age_50 0.5373 0.0410 lambda 0.6691 0.0267 zeta_quality 1.0913 0.0267 zeta_ingredient -0.9350 0.0548 zeta_patent 1.1527 0.0250 zeta_dominance -0.4726 0.0410 tau_quality_1 -1.8015 0.0229 tau_quality_2 -0.8763 0.0255 tau_quality_3 1.2422 0.0414 tau_quality_4 2.3024 0.0409 tau_ingredients_1 -2.1313 0.0292 tau_ingredients_2 -1.0134 0.0237 tau_ingredients_3 0.8767 0.0273 tau_ingredients_4 1.8633 0.0298 tau_patent_1 -1.8953 0.0814 tau_patent_2 -0.8229 0.0230 tau_patent_3 1.1151 0.0472 tau_patent_4 2.0284 0.0240 tau_dominance_1 -2.3070 0.0238 tau_dominance_2 -1.1206 0.0375 tau_dominance_3 0.8250 0.0330 tau_dominance_4 1.7607 0.0386 Results for posterior means for random coefficients These outputs have had the scaling used in estimation applied to them Mean SD b_brand_Artemis_base 1.4147 0.0938 b_brand_Novum_base 1.1181 0.1319 eta 0.0109 0.7628 Summary of distributions of random coeffients (after distributional transforms) These outputs have had the scaling used in estimation applied to them Mean SD b_brand_Artemis_base 1.4140 0.3035 b_brand_Novum_base 1.1101 0.3591 eta -0.0071 1.0020 Covariance matrix of random coeffients (after distributional transforms) These outputs have had the scaling used in estimation applied to them b_brand_Artemis_base b_brand_Novum_base eta b_brand_Artemis_base 0.0921 -0.0002 -0.0038 b_brand_Novum_base -0.0002 0.1290 0.0028 eta -0.0038 0.0028 1.0041 Correlation matrix of random coeffients (after distributional transforms) These outputs have had the scaling used in estimation applied to them b_brand_Artemis_base b_brand_Novum_base eta b_brand_Artemis_base 1.0000 -0.0018 -0.0124 b_brand_Novum_base -0.0018 1.0000 0.0077 eta -0.0124 0.0077 1.0000 Upper level model results for mean parameters for underlying Normals These outputs have NOT had the scaling used in estimation applied to them Mean SD b_brand_Artemis_base 1.4145 0.0551 b_brand_Novum_base 1.1179 0.0586 eta 0.0000 0.0000 Upper level model results for covariance matrix for underlying Normals (means across iterations) These outputs have NOT had the scaling used in estimation applied to them b_brand_Artemis_base b_brand_Novum_base eta b_brand_Artemis_base 0.0926 0.0000 0 b_brand_Novum_base 0.0000 0.1303 0 eta 0.0000 0.0000 1 Upper level model results for covariance matrix for underlying Normals (SD across iterations) These outputs have NOT had the scaling used in estimation applied to them b_brand_Artemis_base b_brand_Novum_base eta b_brand_Artemis_base 0.0236 0.0000 0 b_brand_Novum_base 0.0000 0.0341 0 eta 0.0000 0.0000 0 Chain convergence report (Geweke test) Iteration details (overview) ---------------------------- Iteration Log-Likelihood RLH Parameter RMS Avg. Variance Acceptance Rate (Fixed) 1 -19144.28 0.1494827 0.3185815 0.1002227 0.00 500 -17385.35 0.1805824 0.8858799 0.5587301 0.17 1000 -17051.75 0.1874333 1.0766932 0.7539102 0.08 1500 -16888.27 0.1909240 1.1830043 0.9068934 0.07 2000 -16749.73 0.1931815 1.1847748 0.9834559 0.05 2500 -16679.60 0.1945050 1.1171111 0.8752295 0.08 3000 -16548.68 0.1971756 1.1647459 0.8745217 0.05 3500 -16517.60 0.1974539 1.1550566 0.8942753 0.08 4000 -16405.84 0.1998510 1.1608152 0.9267082 0.11 4500 -16362.84 0.2007819 1.1872741 0.9659448 0.05 5000 -16220.55 0.2040509 1.2062756 0.9765363 0.10 5500 -16206.10 0.2041420 1.2611285 1.0717211 0.10 6000 -16147.34 0.2053267 1.2359875 0.9830730 0.14 6500 -16100.28 0.2057019 1.2276120 1.0167225 0.11 7000 -16122.36 0.2060456 1.2201277 0.9944618 0.15 7500 -16088.49 0.2065789 1.2446066 1.0281309 0.16 8000 -16012.14 0.2083953 1.2477098 0.9514262 0.14 8500 -15983.68 0.2094281 1.2933716 1.0631253 0.15 9000 -16013.71 0.2081708 1.2454855 0.9773951 0.14 9500 -16051.36 0.2078643 1.2600909 0.9904445 0.16 10000 -15984.25 0.2089331 1.2135123 0.8927544 0.12 10500 -15987.41 0.2087643 1.2223175 0.9426687 0.14 11000 -16026.94 0.2079796 1.1825607 0.8907254 0.19 11500 -15970.83 0.2096077 1.2143651 0.9252514 0.22 12000 -15988.48 0.2092898 1.2210806 0.9441597 0.17 12500 -15977.64 0.2095678 1.2378145 0.9729412 0.21 13000 -15937.74 0.2105702 1.2395243 0.9647350 0.15 13500 -16006.32 0.2091530 1.1760244 0.9017967 0.23 14000 -15978.34 0.2097742 1.1650072 0.8263269 0.23 14500 -15951.52 0.2101990 1.2007675 0.9029429 0.23 15000 -15997.26 0.2092061 1.1649143 0.8357986 0.23 15500 -15962.55 0.2099282 1.1832972 0.8622566 0.28 16000 -16018.93 0.2088687 1.1753749 0.8667294 0.36 16500 -15977.82 0.2095813 1.2292565 0.9514296 0.27 17000 -16022.76 0.2087314 1.2430532 0.9471842 0.36 17500 -15942.37 0.2102003 1.2308560 0.9090245 0.40 18000 -15957.88 0.2101740 1.2550070 0.9637907 0.30 18500 -15959.15 0.2099587 1.2683084 0.9912127 0.29 19000 -16019.27 0.2088193 1.2890568 1.0546226 0.23 19500 -15984.20 0.2095832 1.2743412 0.9818071 0.32 20000 -16026.43 0.2089159 1.2667287 0.9518548 0.39 20500 -15936.13 0.2102502 1.2486764 0.9981871 1.03 21000 -15931.68 0.2105569 1.2804994 1.0280268 2.19 21500 -15967.80 0.2097888 1.2704570 1.0157187 0.54 22000 -15949.73 0.2103249 1.2792706 1.0258151 1.65 22500 -15928.00 0.2105986 1.2160996 0.9236322 0.61 23000 -15920.14 0.2108494 1.2110716 0.9380093 0.61 23500 -15958.83 0.2103394 1.2324787 0.9846910 3.29 24000 -16004.57 0.2091298 1.2045195 0.8878121 1.03 24500 -15952.91 0.2101252 1.1797460 0.9075401 2.04 25000 -15998.31 0.2092039 1.1987434 0.9415859 2.04 25500 -15918.55 0.2107371 1.1721654 0.9041105 0.60 26000 -15993.10 0.2093114 1.1639583 0.8428617 0.49 26500 -15973.57 0.2100685 1.2172261 0.9274473 0.25 27000 -15922.87 0.2108676 1.2018658 0.8799683 1.03 27500 -15891.76 0.2115492 1.2051113 0.9375961 0.74 28000 -15959.63 0.2098981 1.1677759 0.8768931 0.54 28500 -15974.83 0.2097966 1.1986231 0.8965001 0.68 29000 -15931.73 0.2105437 1.1853928 0.9012892 0.26 29500 -15933.20 0.2107594 1.2003969 0.9273490 1.02 30000 -15932.25 0.2109919 1.1987164 0.9025345 0.81 Acceptance Rate (Normal) 0.587 0.283 0.313 0.291 0.282 0.279 0.268 0.338 0.288 0.304 0.264 0.313 0.307 0.298 0.255 0.313 0.270 0.310 0.316 0.316 0.319 0.284 0.283 0.322 0.288 0.317 0.281 0.299 0.311 0.313 0.287 0.324 0.281 0.319 0.314 0.296 0.303 0.317 0.283 0.302 0.308 0.297 0.326 0.340 0.293 0.293 0.290 0.271 0.292 0.277 0.306 0.327 0.294 0.282 0.321 0.298 0.276 0.311 0.281 0.286 0.317 Settings and functions used in model definition: apollo_control -------------- Value modelName "Hybrid_with_OL_and_MMNL_bayesian" modelDescr "Hybrid choice model on drug choice data, bayesian estimation" indivID "ID" HB "TRUE" outputDirectory "output/" debug "FALSE" nCores "1" workInLogs "FALSE" seed "13" mixing "FALSE" noValidation "FALSE" noDiagnostics "FALSE" calculateLLC "TRUE" panelData "TRUE" analyticGrad "FALSE" analyticGrad_manualSet "FALSE" overridePanel "FALSE" preventOverridePanel "FALSE" noModification "FALSE" apollo_HB --------- $hbDist b_brand_Artemis_base gamma_Artemis_reg_user gamma_Artemis_university "N" "NR" "NR" gamma_Artemis_age_50 b_brand_Novum_base gamma_Novum_reg_user "NR" "N" "NR" gamma_Novum_university gamma_Novum_age_50 b_brand_BestValue "NR" "NR" "NR" b_brand_Supermarket b_brand_PainAway b_country_CH "NR" "NR" "NR" b_country_DK b_country_USA b_country_IND "NR" "NR" "NR" b_country_RUS b_country_BRA b_char_standard "NR" "NR" "NR" b_char_fast b_char_double b_risk "NR" "NR" "NR" b_price gamma_LV_reg_user gamma_LV_university "NR" "NR" "NR" gamma_LV_age_50 lambda zeta_quality "NR" "NR" "NR" zeta_ingredient zeta_patent zeta_dominance "NR" "NR" "NR" tau_quality_1 tau_quality_2 tau_quality_3 "NR" "NR" "NR" tau_quality_4 tau_ingredients_1 tau_ingredients_2 "NR" "NR" "NR" tau_ingredients_3 tau_ingredients_4 tau_patent_1 "NR" "NR" "NR" tau_patent_2 tau_patent_3 tau_patent_4 "NR" "NR" "NR" tau_dominance_1 tau_dominance_2 tau_dominance_3 "NR" "NR" "NR" tau_dominance_4 eta "NR" "N" $gNCREP [1] 20000 $gNEREP [1] 10000 $gINFOSKIP [1] 500 $fixedA [1] NA NA 0 $fixedD [1] NA NA 1 $gFULLCV [1] FALSE $nodiagnostics [1] TRUE $modelname [1] "Hybrid_with_OL_and_MMNL_bayesian" $gVarNamesFixed [1] "gamma_Artemis_reg_user" "gamma_Artemis_university" "gamma_Artemis_age_50" [4] "gamma_Novum_reg_user" "gamma_Novum_university" "gamma_Novum_age_50" [7] "b_brand_BestValue" "b_brand_Supermarket" "b_country_CH" [10] "b_country_DK" "b_country_IND" "b_country_RUS" [13] "b_country_BRA" "b_char_fast" "b_char_double" [16] "b_risk" "b_price" "gamma_LV_reg_user" [19] "gamma_LV_university" "gamma_LV_age_50" "lambda" [22] "zeta_quality" "zeta_ingredient" "zeta_patent" [25] "zeta_dominance" "tau_quality_1" "tau_quality_2" [28] "tau_quality_3" "tau_quality_4" "tau_ingredients_1" [31] "tau_ingredients_2" "tau_ingredients_3" "tau_ingredients_4" [34] "tau_patent_1" "tau_patent_2" "tau_patent_3" [37] "tau_patent_4" "tau_dominance_1" "tau_dominance_2" [40] "tau_dominance_3" "tau_dominance_4" $gVarNamesNormal [1] "b_brand_Artemis_base" "b_brand_Novum_base" "eta" $gDIST b_brand_Artemis_base b_brand_Novum_base eta 1 1 1 $svN b_brand_Artemis_base b_brand_Novum_base eta 0 0 0 $FC gamma_Artemis_reg_user gamma_Artemis_university gamma_Artemis_age_50 0 0 0 gamma_Novum_reg_user gamma_Novum_university gamma_Novum_age_50 0 0 0 b_brand_BestValue b_brand_Supermarket b_country_CH 0 0 0 b_country_DK b_country_IND b_country_RUS 0 0 0 b_country_BRA b_char_fast b_char_double 0 0 0 b_risk b_price gamma_LV_reg_user 0 0 0 gamma_LV_university gamma_LV_age_50 lambda 0 0 1 zeta_quality zeta_ingredient zeta_patent 1 1 1 zeta_dominance tau_quality_1 tau_quality_2 1 -2 -1 tau_quality_3 tau_quality_4 tau_ingredients_1 1 2 -2 tau_ingredients_2 tau_ingredients_3 tau_ingredients_4 -1 1 2 tau_patent_1 tau_patent_2 tau_patent_3 -2 -1 1 tau_patent_4 tau_dominance_1 tau_dominance_2 2 -2 -1 tau_dominance_3 tau_dominance_4 1 2 Non-random parameters: ----------------------ngamma_Artemis_reg_user gamma_Artemis_university gamma_Artemis_age_50 gamma_Novum_reg_user gamma_Novum_university gamma_Novum_age_50 b_brand_BestValue b_brand_Supermarket b_country_CH b_country_DK b_country_IND b_country_RUS b_country_BRA b_char_fast b_char_double b_risk b_price gamma_LV_reg_user gamma_LV_university gamma_LV_age_50 lambda zeta_quality zeta_ingredient zeta_patent zeta_dominance tau_quality_1 tau_quality_2 tau_quality_3 tau_quality_4 tau_ingredients_1 tau_ingredients_2 tau_ingredients_3 tau_ingredients_4 tau_patent_1 tau_patent_2 tau_patent_3 tau_patent_4 tau_dominance_1 tau_dominance_2 tau_dominance_3 tau_dominance_4 Random parameters (Distribution): ---------------------------------nb_brand_Artemis_base ( ) b_brand_Novum_base ( ) eta ( ) Prior Variance-Covariance Matrix: --------------------------------- b_brand_Artemis_base b_brand_Novum_base eta b_brand_Artemis_base 2 0 0 b_brand_Novum_base 0 2 0 eta 0 0 2 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 random components LV = gamma_LV_reg_user*regular_user + gamma_LV_university*university_educated + gamma_LV_age_50*over_50 + eta b_brand_Artemis = b_brand_Artemis_base + gamma_Artemis_reg_user*regular_user + gamma_Artemis_university*university_educated + gamma_Artemis_age_50*over_50 b_brand_Novum = b_brand_Novum_base + gamma_Novum_reg_user*regular_user + gamma_Novum_university*university_educated + gamma_Novum_age_50*over_50 ### Create list of probabilities P P = list() ### Likelihood of choices ### 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 + lambda*LV ) 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 + lambda*LV ) 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 ) ### Define settings for MNL model component 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, utilities = V ) ### Compute probabilities for MNL model component P[["choice"]] = apollo_mnl(mnl_settings, functionality) ### Likelihood of indicators ol_settings1 = list(outcomeOrdered = attitude_quality, utility = zeta_quality*LV, tau = list(tau_quality_1, tau_quality_2, tau_quality_3, tau_quality_4), rows = (task==1)) ol_settings2 = list(outcomeOrdered = attitude_ingredients, utility = zeta_ingredient*LV, tau = list(tau_ingredients_1, tau_ingredients_2, tau_ingredients_3, tau_ingredients_4), rows = (task==1)) ol_settings3 = list(outcomeOrdered = attitude_patent, utility = zeta_patent*LV, tau = list(tau_patent_1, tau_patent_2, tau_patent_3, tau_patent_4), rows = (task==1)) ol_settings4 = list(outcomeOrdered = attitude_dominance, utility = zeta_dominance*LV, tau = list(tau_dominance_1, tau_dominance_2, tau_dominance_3, tau_dominance_4), rows = (task==1)) P[["indic_quality"]] = apollo_ol(ol_settings1, functionality) P[["indic_ingredients"]] = apollo_ol(ol_settings2, functionality) P[["indic_patent"]] = apollo_ol(ol_settings3, functionality) P[["indic_dominance"]] = apollo_ol(ol_settings4, functionality) ### Likelihood of the whole model P = apollo_combineModels(P, apollo_inputs, functionality) ### Prepare and return outputs of function P = apollo_prepareProb(P, apollo_inputs, functionality) return(P) }