Model run by stephane.hess using Apollo 0.2.9 on R 4.0.5 for Darwin. www.ApolloChoiceModelling.com Model name : HB_MMNL Model description : HB model on mode choice SP data, mix of random and non-random parameters Model run at : 2023-05-12 11:06:12 Estimation method : Hierarchical Bayes Number of individuals : 500 Number of rows in database : 7000 Number of modelled outcomes : 7000 Number of cores used : 1 Estimation carried out using RSGHB Burn-in iterations : 10000 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) : -19242.48 LL at equal shares, LL(0) : -8196.02 LL at observed shares, LL(C) : -6706.94 LL(final) : -4918.04 Rho-squared vs equal shares : 0.3999 Adj.Rho-squared vs equal shares : 0.3898 Rho-squared vs observed shares : 0.2667 Adj.Rho-squared vs observed shares : 0.2543 AIC : 10002.09 BIC : 10570.94 Equiv. estimated parameters : 83 (non-random parameters : 6) (means of random parameters : 11) (covariance matrix terms : 66) Time taken (hh:mm:ss) : 00:06:14.39 pre-estimation : 00:00:0.33 estimation : 00:06:11.14 post-estimation : 00:00:2.93 Summary of parameter chains Non-random coefficients Mean SD asc_car 0.0000 NA asc_bus_shift_female -0.0740 0.0424 asc_air_shift_female 0.1564 0.0510 asc_rail_shift_female 0.0880 0.0456 b_tt_shift_business -0.0078 0.0007 b_cost_shift_business 0.0273 0.0032 cost_income_elast -0.6294 0.0356 b_no_frills 0.0000 NA Results for posterior means for random coefficients Mean SD asc_bus -0.3676 0.0404 asc_air -0.4400 0.0504 asc_rail -1.4876 0.0528 b_tt_car -0.0102 0.0008 b_tt_bus -0.0180 0.0015 b_tt_air -0.0119 0.0008 b_tt_rail -0.0050 0.0003 b_access -0.0200 0.0019 b_cost -0.0749 0.0058 b_wifi 1.0223 0.1472 b_food 0.4323 0.1105 Summary of distributions of random coeffients (after distributional transforms) Mean SD asc_bus -0.3671 0.4984 asc_air -0.4369 0.4111 asc_rail -1.4901 0.4046 b_tt_car -0.0102 0.0024 b_tt_bus -0.0180 0.0043 b_tt_air -0.0117 0.0050 b_tt_rail -0.0049 0.0020 b_access -0.0199 0.0090 b_cost -0.0748 0.0161 b_wifi 1.0189 0.4379 b_food 0.4307 0.3868 Covariance matrix of random coeffients (after distributional transforms) asc_bus asc_air asc_rail b_tt_car b_tt_bus b_tt_air b_tt_rail b_access b_cost b_wifi b_food asc_bus 0.2485 -0.0126 -0.0022 0e+00 -7e-04 -2e-04 0e+00 2e-04 2e-04 0.0132 0.0219 asc_air -0.0126 0.1690 0.0350 1e-04 2e-04 -5e-04 1e-04 -8e-04 -6e-04 -0.0210 0.0048 asc_rail -0.0022 0.0350 0.1637 3e-04 4e-04 3e-04 -3e-04 4e-04 6e-04 -0.0300 -0.0217 b_tt_car 0.0000 0.0001 0.0003 0e+00 0e+00 0e+00 0e+00 0e+00 0e+00 0.0001 0.0000 b_tt_bus -0.0007 0.0002 0.0004 0e+00 0e+00 0e+00 0e+00 0e+00 0e+00 -0.0002 0.0000 b_tt_air -0.0002 -0.0005 0.0003 0e+00 0e+00 0e+00 0e+00 0e+00 0e+00 0.0000 -0.0002 b_tt_rail 0.0000 0.0001 -0.0003 0e+00 0e+00 0e+00 0e+00 0e+00 0e+00 0.0000 0.0000 b_access 0.0002 -0.0008 0.0004 0e+00 0e+00 0e+00 0e+00 1e-04 0e+00 0.0005 -0.0002 b_cost 0.0002 -0.0006 0.0006 0e+00 0e+00 0e+00 0e+00 0e+00 3e-04 -0.0009 -0.0009 b_wifi 0.0132 -0.0210 -0.0300 1e-04 -2e-04 0e+00 0e+00 5e-04 -9e-04 0.1918 0.0411 b_food 0.0219 0.0048 -0.0217 0e+00 0e+00 -2e-04 0e+00 -2e-04 -9e-04 0.0411 0.1496 Correlation matrix of random coeffients (after distributional transforms) asc_bus asc_air asc_rail b_tt_car b_tt_bus b_tt_air b_tt_rail b_access b_cost b_wifi b_food asc_bus 1.0000 -0.0613 -0.0108 0.0143 -0.3140 -0.0774 -0.0320 0.0437 0.0187 0.0605 0.1134 asc_air -0.0613 1.0000 0.2103 0.0732 0.0925 -0.2233 0.1061 -0.2222 -0.0890 -0.1169 0.0304 asc_rail -0.0108 0.2103 1.0000 0.2954 0.2076 0.1260 -0.3075 0.0991 0.0927 -0.1691 -0.1390 b_tt_car 0.0143 0.0732 0.2954 1.0000 0.2123 0.0850 0.1163 0.2721 0.2219 0.1176 0.0217 b_tt_bus -0.3140 0.0925 0.2076 0.2123 1.0000 0.0479 0.0821 -0.0099 0.2764 -0.1157 -0.0029 b_tt_air -0.0774 -0.2233 0.1260 0.0850 0.0479 1.0000 0.0580 -0.0607 -0.0960 0.0067 -0.1022 b_tt_rail -0.0320 0.1061 -0.3075 0.1163 0.0821 0.0580 1.0000 0.0333 0.0021 0.0136 0.0459 b_access 0.0437 -0.2222 0.0991 0.2721 -0.0099 -0.0607 0.0333 1.0000 -0.0067 0.1310 -0.0478 b_cost 0.0187 -0.0890 0.0927 0.2219 0.2764 -0.0960 0.0021 -0.0067 1.0000 -0.1261 -0.1403 b_wifi 0.0605 -0.1169 -0.1691 0.1176 -0.1157 0.0067 0.0136 0.1310 -0.1261 1.0000 0.2428 b_food 0.1134 0.0304 -0.1390 0.0217 -0.0029 -0.1022 0.0459 -0.0478 -0.1403 0.2428 1.0000 Upper level model results for mean parameters for underlying Normals Mean SD asc_bus -0.3675 0.2269 asc_air -0.4402 0.1603 asc_rail -1.4875 0.1268 b_tt_car -4.6137 0.0620 b_tt_bus -4.0458 0.0704 b_tt_air -4.5425 0.2453 b_tt_rail -5.3902 0.2284 b_access -4.0122 0.1087 b_cost -2.6139 0.0348 b_wifi 1.0199 0.0579 b_food 0.3700 0.0837 Upper level model results for covariance matrix for underlying Normals (means across iterations) asc_bus asc_air asc_rail b_tt_car b_tt_bus b_tt_air b_tt_rail b_access b_cost b_wifi b_food asc_bus 0.2470 -0.0103 -0.0037 -0.0026 0.0357 0.0176 0.0054 -0.0102 -0.0033 0.0159 0.0291 asc_air -0.0103 0.1666 0.0334 -0.0064 -0.0077 0.0418 -0.0166 0.0424 0.0089 -0.0176 0.0066 asc_rail -0.0037 0.0334 0.1615 -0.0277 -0.0197 -0.0213 0.0505 -0.0193 -0.0076 -0.0269 -0.0250 b_tt_car -0.0026 -0.0064 -0.0277 0.0517 0.0111 0.0076 0.0103 0.0273 0.0109 -0.0141 -0.0039 b_tt_bus 0.0357 -0.0077 -0.0197 0.0111 0.0551 0.0046 0.0092 -0.0020 0.0143 0.0110 -0.0004 b_tt_air 0.0176 0.0418 -0.0213 0.0076 0.0046 0.1675 0.0067 -0.0130 -0.0082 -0.0024 0.0209 b_tt_rail 0.0054 -0.0166 0.0505 0.0103 0.0092 0.0067 0.1502 0.0038 0.0021 -0.0025 -0.0109 b_access -0.0102 0.0424 -0.0193 0.0273 -0.0020 -0.0130 0.0038 0.1889 -0.0012 -0.0280 0.0113 b_cost -0.0033 0.0089 -0.0076 0.0109 0.0143 -0.0082 0.0021 -0.0012 0.0461 0.0123 0.0129 b_wifi 0.0159 -0.0176 -0.0269 -0.0141 0.0110 -0.0024 -0.0025 -0.0280 0.0123 0.1977 0.0541 b_food 0.0291 0.0066 -0.0250 -0.0039 -0.0004 0.0209 -0.0109 0.0113 0.0129 0.0541 0.2269 Upper level model results for covariance matrix for underlying Normals (SD across iterations) asc_bus asc_air asc_rail b_tt_car b_tt_bus b_tt_air b_tt_rail b_access b_cost b_wifi b_food asc_bus 0.1002 0.0466 0.0499 0.0209 0.0234 0.0625 0.0541 0.0563 0.0189 0.0749 0.0638 asc_air 0.0466 0.0462 0.0414 0.0172 0.0184 0.0398 0.0401 0.0459 0.0126 0.0450 0.0537 asc_rail 0.0499 0.0414 0.0568 0.0160 0.0196 0.0373 0.0387 0.0362 0.0139 0.0466 0.0373 b_tt_car 0.0209 0.0172 0.0160 0.0106 0.0078 0.0122 0.0163 0.0189 0.0062 0.0180 0.0202 b_tt_bus 0.0234 0.0184 0.0196 0.0078 0.0114 0.0161 0.0168 0.0171 0.0068 0.0238 0.0211 b_tt_air 0.0625 0.0398 0.0373 0.0122 0.0161 0.0560 0.0362 0.0317 0.0122 0.0454 0.0430 b_tt_rail 0.0541 0.0401 0.0387 0.0163 0.0168 0.0362 0.0542 0.0383 0.0123 0.0359 0.0458 b_access 0.0563 0.0459 0.0362 0.0189 0.0171 0.0317 0.0383 0.0781 0.0157 0.0483 0.0546 b_cost 0.0189 0.0126 0.0139 0.0062 0.0068 0.0122 0.0123 0.0157 0.0077 0.0160 0.0173 b_wifi 0.0749 0.0450 0.0466 0.0180 0.0238 0.0454 0.0359 0.0483 0.0160 0.0581 0.0635 b_food 0.0638 0.0537 0.0373 0.0202 0.0211 0.0430 0.0458 0.0546 0.0173 0.0635 0.1130 Chain convergence report (Geweke test) Iteration details (overview) ---------------------------- Iteration Log-Likelihood RLH Parameter RMS Avg. Variance Acceptance Rate (Fixed) 1 -15997.157 0.2470729 0.1636402 0.02680893 0.00 500 -4592.363 0.5406779 0.4537739 0.21582875 0.05 1000 -4589.395 0.5399614 0.4731566 0.22807965 0.04 1500 -4644.737 0.5351169 0.4355273 0.19586360 0.06 2000 -4653.333 0.5346844 0.4701889 0.22608203 0.03 2500 -4639.244 0.5362750 0.5065644 0.26992199 0.01 3000 -4576.531 0.5408484 0.5440610 0.30490826 0.03 3500 -4595.711 0.5388318 0.5546485 0.32569748 0.00 4000 -4589.263 0.5392456 0.5697910 0.34515040 0.01 4500 -4626.473 0.5369844 0.5456834 0.31836351 0.02 5000 -4598.512 0.5392522 0.5455997 0.31919421 0.04 5500 -4624.758 0.5374033 0.5426151 0.31449316 0.07 6000 -4576.550 0.5404610 0.5122100 0.27853756 0.04 6500 -4612.941 0.5374432 0.5730241 0.35020160 0.06 7000 -4566.497 0.5404937 0.6013381 0.38014424 0.02 7500 -4587.655 0.5400362 0.5856244 0.36542150 0.06 8000 -4583.120 0.5394207 0.5760909 0.35814838 0.02 8500 -4620.980 0.5375756 0.5688512 0.35018453 0.01 9000 -4614.015 0.5373266 0.5906955 0.37487405 0.09 9500 -4631.227 0.5363208 0.5828891 0.36596811 0.07 10000 -4642.399 0.5353973 0.5912591 0.37563351 0.10 10500 -4580.332 0.5398748 0.5917071 0.37392510 0.12 11000 -4615.131 0.5375047 0.6208010 0.41287309 0.33 11500 -4589.862 0.5387993 0.6310758 0.42849073 0.33 12000 -4646.452 0.5352895 0.6843944 0.49823622 0.33 12500 -4592.494 0.5393082 0.6758559 0.48775627 0.33 13000 -4587.264 0.5394211 0.6729358 0.48559088 1.57 13500 -4617.046 0.5370686 0.6938419 0.51535886 1.57 14000 -4649.420 0.5352567 0.6443260 0.44309413 1.57 14500 -4624.634 0.5368164 0.7033316 0.51503632 1.57 15000 -4642.360 0.5355267 0.6573974 0.44995981 1.57 15500 -4621.424 0.5365943 0.6678603 0.47188778 1.57 16000 -4601.305 0.5383207 0.6478470 0.44200577 2.19 16500 -4620.923 0.5369979 0.6263447 0.41601955 2.19 17000 -4638.914 0.5351073 0.6514052 0.44823645 2.19 17500 -4648.649 0.5346462 0.6503526 0.44698161 1.16 18000 -4621.898 0.5367586 0.6769078 0.48116360 0.71 18500 -4603.209 0.5383932 0.7144801 0.52938291 0.71 19000 -4652.845 0.5350398 0.7007248 0.51389792 0.71 19500 -4633.546 0.5362706 0.7013322 0.50953023 0.83 20000 -4624.456 0.5368503 0.6199782 0.39725941 0.83 Acceptance Rate (Normal) 0.364 0.318 0.342 0.268 0.328 0.300 0.338 0.272 0.360 0.298 0.282 0.314 0.292 0.356 0.322 0.298 0.328 0.290 0.260 0.266 0.306 0.318 0.300 0.312 0.298 0.326 0.294 0.294 0.294 0.306 0.272 0.270 0.274 0.274 0.306 0.284 0.252 0.278 0.256 0.282 0.360 Settings and functions used in model definition: apollo_control -------------- Value modelName "HB_MMNL" modelDescr "HB model on mode choice SP data, mix of random and non-random parameters" 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 asc_car asc_bus asc_air asc_rail asc_bus_shift_female "NR" "N" "N" "N" "NR" asc_air_shift_female asc_rail_shift_female b_tt_car b_tt_bus b_tt_air "NR" "NR" "LN-" "LN-" "LN-" b_tt_rail b_tt_shift_business b_access b_cost b_cost_shift_business "LN-" "NR" "LN-" "LN-" "NR" cost_income_elast b_no_frills b_wifi b_food "NR" "NR" "CN+" "CN+" $gNCREP [1] 10000 $gNEREP [1] 10000 $gINFOSKIP [1] 500 $nodiagnostics [1] TRUE $modelname [1] "HB_MMNL" $gVarNamesFixed [1] "asc_bus_shift_female" "asc_air_shift_female" "asc_rail_shift_female" "b_tt_shift_business" [5] "b_cost_shift_business" "cost_income_elast" $gVarNamesNormal [1] "asc_bus" "asc_air" "asc_rail" "b_tt_car" "b_tt_bus" "b_tt_air" "b_tt_rail" "b_access" [9] "b_cost" "b_wifi" "b_food" $gDIST asc_bus asc_air asc_rail b_tt_car b_tt_bus b_tt_air b_tt_rail b_access b_cost b_wifi b_food 1 1 1 3 3 3 3 3 3 4 4 $svN asc_bus asc_air asc_rail b_tt_car b_tt_bus b_tt_air b_tt_rail b_access b_cost b_wifi b_food 0 0 0 -3 -3 -3 -3 -3 -3 0 0 $FC asc_bus_shift_female asc_air_shift_female asc_rail_shift_female b_tt_shift_business b_cost_shift_business 0 0 0 0 0 cost_income_elast 0 $gFULLCV [1] TRUE Non-random parameters: ----------------------nasc_bus_shift_female asc_air_shift_female asc_rail_shift_female b_tt_shift_business b_cost_shift_business cost_income_elast Random parameters (Distribution): ---------------------------------nasc_bus ( ) asc_air ( ) asc_rail ( ) b_tt_car ( ) b_tt_bus ( ) b_tt_air ( ) b_tt_rail ( ) b_access ( ) b_cost ( ) b_wifi ( ) b_food ( ) Prior Variance-Covariance Matrix: --------------------------------- asc_bus asc_air asc_rail b_tt_car b_tt_bus b_tt_air b_tt_rail b_access b_cost b_wifi b_food asc_bus 2 0 0 0 0 0 0 0 0 0 0 asc_air 0 2 0 0 0 0 0 0 0 0 0 asc_rail 0 0 2 0 0 0 0 0 0 0 0 b_tt_car 0 0 0 2 0 0 0 0 0 0 0 b_tt_bus 0 0 0 0 2 0 0 0 0 0 0 b_tt_air 0 0 0 0 0 2 0 0 0 0 0 b_tt_rail 0 0 0 0 0 0 2 0 0 0 0 b_access 0 0 0 0 0 0 0 2 0 0 0 b_cost 0 0 0 0 0 0 0 0 2 0 0 b_wifi 0 0 0 0 0 0 0 0 0 2 0 b_food 0 0 0 0 0 0 0 0 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 list of probabilities P P = list() ### Create alternative specific constants and coefficients using interactions with socio-demographics asc_bus_value = asc_bus + asc_bus_shift_female * female asc_air_value = asc_air + asc_air_shift_female * female asc_rail_value = asc_rail + asc_rail_shift_female * female b_tt_car_value = b_tt_car + b_tt_shift_business * business b_tt_bus_value = b_tt_bus + b_tt_shift_business * business b_tt_air_value = b_tt_air + b_tt_shift_business * business b_tt_rail_value = b_tt_rail + b_tt_shift_business * business b_cost_value = ( b_cost + b_cost_shift_business * business ) * ( income / mean_income ) ^ cost_income_elast ### List of utilities: these must use the same names as in mnl_settings, order is irrelevant V = list() V=list() V[["car"]] = asc_car + b_tt_car_value * time_car + b_cost_value * cost_car V[["bus"]] = asc_bus_value + b_tt_bus_value * time_bus + b_access * access_bus + b_cost_value * cost_bus V[["air"]] = asc_air_value + b_tt_air_value * time_air + b_access * access_air + b_cost_value * cost_air + b_no_frills * ( service_air == 1 ) + b_wifi * ( service_air == 2 ) + b_food * ( service_air == 3 ) V[["rail"]] = asc_rail_value + b_tt_rail_value * time_rail + b_access * access_rail + b_cost_value * cost_rail + b_no_frills * ( service_rail == 1 ) + b_wifi * ( service_rail == 2 ) + b_food * ( service_rail == 3 ) ### Define settings for MNL model component mnl_settings = list( alternatives = c(car=1, bus=2, air=3, rail=4), avail = list(car=av_car, bus=av_bus, air=av_air, rail=av_rail), choiceVar = choice, utilities = V ) ### Compute probabilities using MNL model P[["model"]] = apollo_mnl(mnl_settings, functionality) ### Prepare and return outputs of function P = apollo_prepareProb(P, apollo_inputs, functionality) return(P) }