Model run by stephane.hess using Apollo 0.2.9 on R 4.0.5 for Darwin. www.ApolloChoiceModelling.com Model name : MNL_SP_effects Model description : Simple MNL model on mode choice SP data using effects coding Model run at : 2023-05-10 19:49:37 Estimation method : bfgs Model diagnosis : successful convergence Optimisation diagnosis : Maximum found hessian properties : Negative definitive maximum eigenvalue : -3.300492 Number of individuals : 500 Number of rows in database : 7000 Number of modelled outcomes : 7000 Number of cores used : 1 Model without mixing LL(start) : -8196.02 LL at equal shares, LL(0) : -8196.02 LL at observed shares, LL(C) : -6706.94 LL(final) : -5598.9 Rho-squared vs equal shares : 0.3169 Adj.Rho-squared vs equal shares : 0.3155 Rho-squared vs observed shares : 0.1652 Adj.Rho-squared vs observed shares : 0.164 AIC : 11219.8 BIC : 11295.19 Estimated parameters : 11 Time taken (hh:mm:ss) : 00:00:4.18 pre-estimation : 00:00:0.86 estimation : 00:00:1.35 initial estimation : 00:00:1.25 estimation after rescaling : 00:00:0.09 post-estimation : 00:00:1.97 Iterations : 23 initial estimation : 22 estimation after rescaling : 1 Unconstrained optimisation. Estimates: Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0) asc_car 0.000000 NA NA NA NA asc_bus 0.062464 0.538550 0.1160 0.533037 0.1172 asc_air 0.687312 0.337836 2.0345 0.327753 2.0970 asc_rail -1.032379 0.325719 -3.1695 0.308245 -3.3492 b_tt_car -0.011602 6.5322e-04 -17.7615 6.7832e-04 -17.1045 b_tt_bus -0.017369 0.001452 -11.9631 0.001464 -11.8613 b_tt_air -0.019483 0.002587 -7.5300 0.002475 -7.8718 b_tt_rail -0.006365 0.001704 -3.7349 0.001623 -3.9206 b_access -0.023193 0.002689 -8.6265 0.002645 -8.7678 b_cost -0.058756 0.001487 -39.5176 0.001660 -35.3947 b_wifi 0.488517 0.029550 16.5320 0.030887 15.8164 b_food -0.039479 0.029071 -1.3580 0.029362 -1.3446 Overview of choices for MNL model component : car bus air rail Times available 5446.00 6314.00 5264.00 6118.00 Times chosen 1946.00 358.00 1522.00 3174.00 Percentage chosen overall 27.80 5.11 21.74 45.34 Percentage chosen when available 35.73 5.67 28.91 51.88 Classical covariance matrix: asc_bus asc_air asc_rail b_tt_car b_tt_bus b_tt_air b_tt_rail b_access asc_bus 0.29004 0.03330 0.02760 9.467e-05 -7.1333e-04 -2.329e-05 1.913e-05 -4.894e-05 asc_air 0.03330 0.11413 0.04837 1.2905e-04 3.475e-05 -6.2967e-04 1.262e-05 -5.2869e-04 asc_rail 0.02760 0.04837 0.10609 1.3551e-04 4.137e-05 -3.181e-05 -4.3064e-04 -4.029e-05 b_tt_car 9.467e-05 1.2905e-04 1.3551e-04 4.267e-07 1.188e-07 -5.668e-08 -4.990e-08 -1.837e-08 b_tt_bus -7.1333e-04 3.475e-05 4.137e-05 1.188e-07 2.108e-06 -2.330e-08 -4.995e-08 -9.771e-08 b_tt_air -2.329e-05 -6.2967e-04 -3.181e-05 -5.668e-08 -2.330e-08 6.695e-06 -2.508e-07 2.329e-06 b_tt_rail 1.913e-05 1.262e-05 -4.3064e-04 -4.990e-08 -4.995e-08 -2.508e-07 2.904e-06 -5.919e-07 b_access -4.894e-05 -5.2869e-04 -4.029e-05 -1.837e-08 -9.771e-08 2.329e-06 -5.919e-07 7.228e-06 b_cost 2.028e-05 -9.185e-05 -4.428e-05 2.468e-07 2.528e-07 9.027e-07 5.224e-07 6.306e-07 b_wifi -1.6774e-04 -5.7420e-04 -2.596e-05 -2.880e-06 -2.562e-06 -3.915e-07 -4.945e-06 -1.365e-06 b_food -2.438e-05 2.7498e-04 -2.209e-05 -7.697e-08 7.275e-08 -2.401e-06 2.999e-07 -1.416e-06 b_cost b_wifi b_food asc_bus 2.028e-05 -1.6774e-04 -2.438e-05 asc_air -9.185e-05 -5.7420e-04 2.7498e-04 asc_rail -4.428e-05 -2.596e-05 -2.209e-05 b_tt_car 2.468e-07 -2.880e-06 -7.697e-08 b_tt_bus 2.528e-07 -2.562e-06 7.275e-08 b_tt_air 9.027e-07 -3.915e-07 -2.401e-06 b_tt_rail 5.224e-07 -4.945e-06 2.999e-07 b_access 6.306e-07 -1.365e-06 -1.416e-06 b_cost 2.211e-06 -8.793e-06 -8.628e-07 b_wifi -8.793e-06 8.7319e-04 -3.8272e-04 b_food -8.628e-07 -3.8272e-04 8.4513e-04 Robust covariance matrix: asc_bus asc_air asc_rail b_tt_car b_tt_bus b_tt_air b_tt_rail b_access asc_bus 0.284128 0.02451 0.01950 8.844e-05 -6.9982e-04 -3.251e-05 4.734e-05 7.429e-05 asc_air 0.024514 0.10742 0.04245 1.3218e-04 6.458e-05 -5.3329e-04 5.304e-05 -5.0095e-04 asc_rail 0.019495 0.04245 0.09501 1.2911e-04 5.764e-05 2.259e-05 -3.6180e-04 -3.970e-05 b_tt_car 8.844e-05 1.3218e-04 1.2911e-04 4.601e-07 1.752e-07 4.835e-08 6.102e-08 -7.382e-08 b_tt_bus -6.9982e-04 6.458e-05 5.764e-05 1.752e-07 2.144e-06 9.819e-08 -1.619e-09 -4.737e-07 b_tt_air -3.251e-05 -5.3329e-04 2.259e-05 4.835e-08 9.819e-08 6.126e-06 -3.109e-07 1.806e-06 b_tt_rail 4.734e-05 5.304e-05 -3.6180e-04 6.102e-08 -1.619e-09 -3.109e-07 2.636e-06 -6.387e-07 b_access 7.429e-05 -5.0095e-04 -3.970e-05 -7.382e-08 -4.737e-07 1.806e-06 -6.387e-07 6.997e-06 b_cost 4.522e-05 -8.788e-06 1.228e-05 3.663e-07 2.922e-07 6.893e-07 4.481e-07 5.627e-07 b_wifi -0.002074 -3.0385e-04 2.6153e-04 -2.912e-06 2.416e-06 -3.991e-06 -7.298e-06 3.041e-06 b_food 0.001355 3.0442e-04 -2.5603e-04 -9.480e-07 -4.403e-06 -5.936e-06 7.381e-07 -4.803e-06 b_cost b_wifi b_food asc_bus 4.522e-05 -0.002074 0.001355 asc_air -8.788e-06 -3.0385e-04 3.0442e-04 asc_rail 1.228e-05 2.6153e-04 -2.5603e-04 b_tt_car 3.663e-07 -2.912e-06 -9.480e-07 b_tt_bus 2.922e-07 2.416e-06 -4.403e-06 b_tt_air 6.893e-07 -3.991e-06 -5.936e-06 b_tt_rail 4.481e-07 -7.298e-06 7.381e-07 b_access 5.627e-07 3.041e-06 -4.803e-06 b_cost 2.756e-06 -3.537e-06 -4.450e-06 b_wifi -3.537e-06 9.5399e-04 -4.0822e-04 b_food -4.450e-06 -4.0822e-04 8.6215e-04 Classical correlation matrix: asc_bus asc_air asc_rail b_tt_car b_tt_bus b_tt_air b_tt_rail b_access asc_bus 1.000000 0.18302 0.157356 0.269104 -0.912310 -0.016717 0.020843 -0.03380 asc_air 0.183020 1.00000 0.439588 0.584764 0.070851 -0.720339 0.021915 -0.58207 asc_rail 0.157356 0.43959 1.000000 0.636885 0.087491 -0.037749 -0.775828 -0.04601 b_tt_car 0.269104 0.58476 0.636885 1.000000 0.125274 -0.033533 -0.044825 -0.01046 b_tt_bus -0.912310 0.07085 0.087491 0.125274 1.000000 -0.006202 -0.020190 -0.02503 b_tt_air -0.016717 -0.72034 -0.037749 -0.033533 -0.006202 1.000000 -0.056883 0.33475 b_tt_rail 0.020843 0.02191 -0.775828 -0.044825 -0.020190 -0.056883 1.000000 -0.12919 b_access -0.033799 -0.58207 -0.046010 -0.010459 -0.025032 0.334752 -0.129191 1.00000 b_cost 0.025330 -0.18286 -0.091441 0.254091 0.117098 0.234654 0.206179 0.15776 b_wifi -0.010540 -0.05752 -0.002697 -0.149223 -0.059727 -0.005121 -0.098204 -0.01719 b_food -0.001557 0.02800 -0.002333 -0.004053 0.001724 -0.031918 0.006055 -0.01812 b_cost b_wifi b_food asc_bus 0.02533 -0.010540 -0.001557 asc_air -0.18286 -0.057518 0.027998 asc_rail -0.09144 -0.002697 -0.002333 b_tt_car 0.25409 -0.149223 -0.004053 b_tt_bus 0.11710 -0.059727 0.001724 b_tt_air 0.23465 -0.005121 -0.031918 b_tt_rail 0.20618 -0.098204 0.006055 b_access 0.15776 -0.017185 -0.018123 b_cost 1.00000 -0.200132 -0.019962 b_wifi -0.20013 1.000000 -0.445522 b_food -0.01996 -0.445522 1.000000 Robust correlation matrix: asc_bus asc_air asc_rail b_tt_car b_tt_bus b_tt_air b_tt_rail b_access asc_bus 1.00000 0.14032 0.11865 0.24460 -0.89660 -0.02464 0.05471 0.05269 asc_air 0.14032 1.00000 0.42022 0.59454 0.13457 -0.65738 0.09968 -0.57780 asc_rail 0.11865 0.42022 1.00000 0.61748 0.12770 0.02961 -0.72300 -0.04869 b_tt_car 0.24460 0.59454 0.61748 1.00000 0.17639 0.02880 0.05541 -0.04114 b_tt_bus -0.89660 0.13457 0.12770 0.17639 1.00000 0.02709 -6.8123e-04 -0.12229 b_tt_air -0.02464 -0.65738 0.02961 0.02880 0.02709 1.00000 -0.07738 0.27591 b_tt_rail 0.05471 0.09968 -0.72300 0.05541 -6.8123e-04 -0.07738 1.00000 -0.14873 b_access 0.05269 -0.57780 -0.04869 -0.04114 -0.12229 0.27591 -0.14873 1.00000 b_cost 0.05110 -0.01615 0.02400 0.32526 0.12022 0.16775 0.16629 0.12814 b_wifi -0.12596 -0.03002 0.02747 -0.13899 0.05343 -0.05220 -0.14555 0.03722 b_food 0.08656 0.03163 -0.02829 -0.04760 -0.10240 -0.08168 0.01548 -0.06184 b_cost b_wifi b_food asc_bus 0.05110 -0.12596 0.08656 asc_air -0.01615 -0.03002 0.03163 asc_rail 0.02400 0.02747 -0.02829 b_tt_car 0.32526 -0.13899 -0.04760 b_tt_bus 0.12022 0.05343 -0.10240 b_tt_air 0.16775 -0.05220 -0.08168 b_tt_rail 0.16629 -0.14555 0.01548 b_access 0.12814 0.03722 -0.06184 b_cost 1.00000 -0.06899 -0.09130 b_wifi -0.06899 1.00000 -0.45013 b_food -0.09130 -0.45013 1.00000 20 worst outliers in terms of lowest average per choice prediction: ID Avg prob per choice 464 0.1815917 272 0.2158479 457 0.2243951 82 0.2251268 151 0.2385038 263 0.2422001 186 0.2425677 196 0.2428429 278 0.2514735 77 0.2541711 147 0.2563690 146 0.2608289 276 0.2617143 293 0.2647149 25 0.2674994 400 0.2683082 369 0.2688812 309 0.2704937 304 0.2708668 446 0.2711952 Changes in parameter estimates from starting values: Initial Estimate Difference asc_car 0.000 0.000000 0.000000 asc_bus 0.000 0.062464 0.062464 asc_air 0.000 0.687312 0.687312 asc_rail 0.000 -1.032379 -1.032379 b_tt_car 0.000 -0.011602 -0.011602 b_tt_bus 0.000 -0.017369 -0.017369 b_tt_air 0.000 -0.019483 -0.019483 b_tt_rail 0.000 -0.006365 -0.006365 b_access 0.000 -0.023193 -0.023193 b_cost 0.000 -0.058756 -0.058756 b_wifi 0.000 0.488517 0.488517 b_food 0.000 -0.039479 -0.039479 Settings and functions used in model definition: apollo_control -------------- Value modelName "MNL_SP_effects" modelDescr "Simple MNL model on mode choice SP data using effects coding" 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 asc_bus 0.062464318 asc_air 0.687311970 asc_rail 1.032378575 b_tt_car 0.011602285 b_tt_bus 0.017368681 b_tt_air 0.019483427 b_tt_rail 0.006364755 b_access 0.023193011 b_cost 0.058756123 b_wifi 0.488517250 b_food 0.039479343 Scaling used in computing Hessian --------------------------------- Value asc_bus 0.062464317 asc_air 0.687311943 asc_rail 1.032378537 b_tt_car 0.011602279 b_tt_bus 0.017368689 b_tt_air 0.019483429 b_tt_rail 0.006364755 b_access 0.023193012 b_cost 0.058756107 b_wifi 0.488517276 b_food 0.039479343 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() ### Effects coding constraint b_no_frills = - b_wifi - b_food ### List of utilities: these must use the same names as in mnl_settings, order is irrelevant V = list() V[["car"]] = asc_car + b_tt_car * time_car + b_cost * cost_car V[["bus"]] = asc_bus + b_tt_bus * time_bus + b_access * access_bus + b_cost * cost_bus V[["air"]] = asc_air + b_tt_air * time_air + b_access * access_air + b_cost * cost_air + b_no_frills * ( service_air == 1 ) + b_wifi * ( service_air == 2 ) + b_food * ( service_air == 3 ) V[["rail"]] = asc_rail + b_tt_rail * time_rail + b_access * access_rail + b_cost * 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) ### 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) }