Model run by stephane.hess using Apollo 0.3.6 on R 4.5.1 for Darwin. Please acknowledge the use of Apollo by citing Hess & Palma (2019) DOI 10.1016/j.jocm.2019.100170 www.ApolloChoiceModelling.com Model name : LC_with_covariates Model description : LC model with covariates in class allocation model on Swiss route choice data Model run at : 2025-09-19 12:58:33.977219 Estimation method : bgw Estimation diagnosis : Relative function convergence Optimisation diagnosis : Maximum found hessian properties : Negative definite maximum eigenvalue : -8.872027 reciprocal of condition number : 5.37479e-05 Number of individuals : 388 Number of rows in database : 3492 Number of modelled outcomes : 3492 Number of cores used : 3 Model without mixing LL(start) : -2067.4 LL (whole model) at equal shares, LL(0) : -2420.47 LL (whole model) at observed shares, LL(C) : -2420.39 LL(final, whole model) : -1559.01 Rho-squared vs equal shares : 0.3559 Adj.Rho-squared vs equal shares : 0.3509 Rho-squared vs observed shares : 0.3559 Adj.Rho-squared vs observed shares : 0.3518 AIC : 3142.03 BIC : 3215.93 LL(0,Class_1) : -2420.47 LL(final,Class_1) : -2467.08 LL(0,Class_2) : -2420.47 LL(final,Class_2) : -1776.34 Estimated parameters : 12 Time taken (hh:mm:ss) : 00:00:4.3 pre-estimation : 00:00:1.81 estimation : 00:00:1.02 post-estimation : 00:00:1.46 Iterations : 25 Unconstrained optimisation. Estimates: Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0) asc_1 -0.03463 0.047659 -0.7265 0.052802 -0.6558 asc_2 0.00000 NA NA NA NA beta_tt_a -0.20953 0.025248 -8.2987 0.048028 -4.3626 beta_tt_b -0.03724 0.005434 -6.8534 0.009954 -3.7417 beta_tc_a -0.77575 0.082903 -9.3574 0.116562 -6.6553 beta_tc_b -0.04989 0.013038 -3.8268 0.013418 -3.7185 beta_hw_a -0.05467 0.005467 -9.9985 0.008673 -6.3032 beta_hw_b -0.03426 0.003120 -10.9826 0.004998 -6.8549 beta_ch_a -2.67043 0.222946 -11.9779 0.300252 -8.8939 beta_ch_b -0.60949 0.074744 -8.1543 0.104717 -5.8203 delta_a 0.20948 0.219723 0.9534 0.252732 0.8288 gamma_commute_a 0.43369 0.327174 1.3256 0.363988 1.1915 gamma_car_av_a -0.58816 0.281345 -2.0905 0.303561 -1.9375 delta_b 0.00000 NA NA NA NA gamma_commute_b 0.00000 NA NA NA NA gamma_car_av_b 0.00000 NA NA NA NA Summary of class allocation for model component : Mean prob. Class_1 0.5269 Class_2 0.4731 Overview of choices for MNL model component Class_1: alt1 alt2 Times available 3492.00 3492.00 Times chosen 1734.00 1758.00 Percentage chosen overall 49.66 50.34 Percentage chosen when available 49.66 50.34 Overview of choices for MNL model component Class_2: alt1 alt2 Times available 3492.00 3492.00 Times chosen 1734.00 1758.00 Percentage chosen overall 49.66 50.34 Percentage chosen when available 49.66 50.34 Classical covariance matrix: asc_1 beta_tt_a beta_tt_b beta_tc_a beta_tc_b asc_1 0.002271 -7.440e-05 1.807e-05 -1.1504e-04 1.604e-05 beta_tt_a -7.440e-05 6.3746e-04 -3.520e-05 0.001872 -8.826e-06 beta_tt_b 1.807e-05 -3.520e-05 2.953e-05 -3.690e-05 5.168e-05 beta_tc_a -1.1504e-04 0.001872 -3.690e-05 0.006873 3.300e-05 beta_tc_b 1.604e-05 -8.826e-06 5.168e-05 3.300e-05 1.7000e-04 beta_hw_a -2.568e-06 5.975e-05 -6.072e-06 1.5908e-04 -2.267e-06 beta_hw_b 2.579e-06 -4.319e-06 5.346e-06 1.701e-05 5.681e-06 beta_ch_a 5.399e-05 0.004080 -8.096e-05 0.012081 2.5278e-04 beta_ch_b -1.315e-05 5.3359e-04 9.395e-05 0.002311 1.3475e-04 delta_a -8.244e-05 0.002029 7.492e-05 0.007216 3.4620e-04 gamma_commute_a 2.7131e-04 3.1428e-04 1.4485e-04 0.001102 1.8260e-04 gamma_car_av_a 6.073e-05 -8.1661e-04 8.023e-05 -0.001973 -6.402e-06 beta_hw_a beta_hw_b beta_ch_a beta_ch_b delta_a asc_1 -2.568e-06 2.579e-06 5.399e-05 -1.315e-05 -8.244e-05 beta_tt_a 5.975e-05 -4.319e-06 0.004080 5.3359e-04 0.002029 beta_tt_b -6.072e-06 5.346e-06 -8.096e-05 9.395e-05 7.492e-05 beta_tc_a 1.5908e-04 1.701e-05 0.012081 0.002311 0.007216 beta_tc_b -2.267e-06 5.681e-06 2.5278e-04 1.3475e-04 3.4620e-04 beta_hw_a 2.989e-05 -6.205e-06 5.3700e-04 -3.400e-05 1.7856e-04 beta_hw_b -6.205e-06 9.732e-06 -2.285e-05 9.514e-05 6.827e-05 beta_ch_a 5.3700e-04 -2.285e-05 0.049705 0.004212 0.018884 beta_ch_b -3.400e-05 9.514e-05 0.004212 0.005587 0.006644 delta_a 1.7856e-04 6.827e-05 0.018884 0.006644 0.048278 gamma_commute_a -1.7972e-04 1.5432e-04 0.012434 0.002887 -0.017283 gamma_car_av_a -2.4242e-04 6.861e-05 -0.008948 1.6013e-04 -0.031903 gamma_commute_a gamma_car_av_a asc_1 2.7131e-04 6.073e-05 beta_tt_a 3.1428e-04 -8.1661e-04 beta_tt_b 1.4485e-04 8.023e-05 beta_tc_a 0.001102 -0.001973 beta_tc_b 1.8260e-04 -6.402e-06 beta_hw_a -1.7972e-04 -2.4242e-04 beta_hw_b 1.5432e-04 6.861e-05 beta_ch_a 0.012434 -0.008948 beta_ch_b 0.002887 1.6013e-04 delta_a -0.017283 -0.031903 gamma_commute_a 0.107043 -0.005328 gamma_car_av_a -0.005328 0.079155 Robust covariance matrix: asc_1 beta_tt_a beta_tt_b beta_tc_a beta_tc_b asc_1 0.002788 -4.5078e-04 5.049e-05 -0.001055 5.285e-05 beta_tt_a -4.5078e-04 0.002307 -3.1594e-04 0.005030 -1.8664e-04 beta_tt_b 5.049e-05 -3.1594e-04 9.908e-05 -5.2674e-04 8.470e-05 beta_tc_a -0.001055 0.005030 -5.2674e-04 0.013587 -3.1742e-04 beta_tc_b 5.285e-05 -1.8664e-04 8.470e-05 -3.1742e-04 1.8004e-04 beta_hw_a -1.821e-05 2.1001e-04 -4.601e-05 3.0735e-04 -2.754e-05 beta_hw_b -5.849e-06 -6.454e-05 2.555e-05 -3.333e-05 1.840e-05 beta_ch_a -5.7124e-04 0.011024 -0.001425 0.021567 -5.5652e-04 beta_ch_b -5.7340e-04 0.001184 1.5053e-04 0.005061 1.1115e-04 delta_a -0.001374 0.006216 -6.2134e-04 0.016035 -2.7604e-04 gamma_commute_a 6.9042e-04 -0.003103 0.001081 -0.005911 0.001043 gamma_car_av_a 0.001279 -0.003973 8.1031e-04 -0.006598 5.4356e-04 beta_hw_a beta_hw_b beta_ch_a beta_ch_b delta_a asc_1 -1.821e-05 -5.849e-06 -5.7124e-04 -5.7340e-04 -0.001374 beta_tt_a 2.1001e-04 -6.454e-05 0.011024 0.001184 0.006216 beta_tt_b -4.601e-05 2.555e-05 -0.001425 1.5053e-04 -6.2134e-04 beta_tc_a 3.0735e-04 -3.333e-05 0.021567 0.005061 0.016035 beta_tc_b -2.754e-05 1.840e-05 -5.5652e-04 1.1115e-04 -2.7604e-04 beta_hw_a 7.521e-05 -2.723e-05 0.001407 -2.1252e-04 5.6257e-04 beta_hw_b -2.723e-05 2.498e-05 -3.7584e-04 2.5476e-04 -5.942e-05 beta_ch_a 0.001407 -3.7584e-04 0.090151 0.005652 0.037581 beta_ch_b -2.1252e-04 2.5476e-04 0.005652 0.010966 0.013010 delta_a 5.6257e-04 -5.942e-05 0.037581 0.013010 0.063874 gamma_commute_a -0.001076 7.2926e-04 0.005057 0.004993 -0.023467 gamma_car_av_a -0.001059 4.5829e-04 -0.032562 5.0566e-04 -0.041713 gamma_commute_a gamma_car_av_a asc_1 6.9042e-04 0.001279 beta_tt_a -0.003103 -0.003973 beta_tt_b 0.001081 8.1031e-04 beta_tc_a -0.005911 -0.006598 beta_tc_b 0.001043 5.4356e-04 beta_hw_a -0.001076 -0.001059 beta_hw_b 7.2926e-04 4.5829e-04 beta_ch_a 0.005057 -0.032562 beta_ch_b 0.004993 5.0566e-04 delta_a -0.023467 -0.041713 gamma_commute_a 0.132487 0.003304 gamma_car_av_a 0.003304 0.092149 Classical correlation matrix: asc_1 beta_tt_a beta_tt_b beta_tc_a beta_tc_b asc_1 1.000000 -0.06183 0.06975 -0.02912 0.025808 beta_tt_a -0.061834 1.00000 -0.25651 0.89428 -0.026810 beta_tt_b 0.069751 -0.25651 1.00000 -0.08190 0.729356 beta_tc_a -0.029116 0.89428 -0.08190 1.00000 0.030532 beta_tc_b 0.025808 -0.02681 0.72936 0.03053 1.000000 beta_hw_a -0.009854 0.43285 -0.20437 0.35097 -0.031808 beta_hw_b 0.017348 -0.05483 0.31533 0.06577 0.139671 beta_ch_a 0.005081 0.72486 -0.06682 0.65363 0.086962 beta_ch_b -0.003691 0.28275 0.23130 0.37289 0.138265 delta_a -0.007873 0.36582 0.06275 0.39614 0.120846 gamma_commute_a 0.017400 0.03805 0.08147 0.04064 0.042805 gamma_car_av_a 0.004529 -0.11496 0.05247 -0.08460 -0.001745 beta_hw_a beta_hw_b beta_ch_a beta_ch_b delta_a asc_1 -0.009854 0.01735 0.005081 -0.003691 -0.007873 beta_tt_a 0.432846 -0.05483 0.724861 0.282749 0.365815 beta_tt_b -0.204373 0.31533 -0.066821 0.231299 0.062748 beta_tc_a 0.350973 0.06577 0.653628 0.372891 0.396135 beta_tc_b -0.031808 0.13967 0.086962 0.138265 0.120846 beta_hw_a 1.000000 -0.36383 0.440551 -0.083209 0.148636 beta_hw_b -0.363833 1.00000 -0.032851 0.408024 0.099600 beta_ch_a 0.440551 -0.03285 1.000000 0.252789 0.385503 beta_ch_b -0.083209 0.40802 0.252789 1.000000 0.404525 delta_a 0.148636 0.09960 0.385503 0.404525 1.000000 gamma_commute_a -0.100470 0.15120 0.170459 0.118057 -0.240416 gamma_car_av_a -0.157598 0.07817 -0.142663 0.007615 -0.516076 gamma_commute_a gamma_car_av_a asc_1 0.01740 0.004529 beta_tt_a 0.03805 -0.114961 beta_tt_b 0.08147 0.052473 beta_tc_a 0.04064 -0.084598 beta_tc_b 0.04281 -0.001745 beta_hw_a -0.10047 -0.157598 beta_hw_b 0.15120 0.078172 beta_ch_a 0.17046 -0.142663 beta_ch_b 0.11806 0.007615 delta_a -0.24042 -0.516076 gamma_commute_a 1.00000 -0.057887 gamma_car_av_a -0.05789 1.000000 Robust correlation matrix: asc_1 beta_tt_a beta_tt_b beta_tc_a beta_tc_b asc_1 1.00000 -0.1778 0.09607 -0.17148 0.07460 beta_tt_a -0.17776 1.0000 -0.66088 0.89849 -0.28962 beta_tt_b 0.09607 -0.6609 1.00000 -0.45400 0.63418 beta_tc_a -0.17148 0.8985 -0.45400 1.00000 -0.20295 beta_tc_b 0.07460 -0.2896 0.63418 -0.20295 1.00000 beta_hw_a -0.03976 0.5042 -0.53300 0.30403 -0.23667 beta_hw_b -0.02216 -0.2689 0.51366 -0.05721 0.27439 beta_ch_a -0.03603 0.7645 -0.47697 0.61624 -0.13814 beta_ch_b -0.10370 0.2354 0.14442 0.41461 0.07911 delta_a -0.10297 0.5121 -0.24699 0.54431 -0.08140 gamma_commute_a 0.03592 -0.1775 0.29838 -0.13933 0.21357 gamma_car_av_a 0.07982 -0.2725 0.26818 -0.18647 0.13345 beta_hw_a beta_hw_b beta_ch_a beta_ch_b delta_a asc_1 -0.03976 -0.02216 -0.03603 -0.10370 -0.10297 beta_tt_a 0.50420 -0.26887 0.76447 0.23540 0.51214 beta_tt_b -0.53300 0.51366 -0.47697 0.14442 -0.24699 beta_tc_a 0.30403 -0.05721 0.61624 0.41461 0.54431 beta_tc_b -0.23667 0.27439 -0.13814 0.07911 -0.08140 beta_hw_a 1.00000 -0.62809 0.54025 -0.23401 0.25667 beta_hw_b -0.62809 1.00000 -0.25045 0.48676 -0.04704 beta_ch_a 0.54025 -0.25045 1.00000 0.17975 0.49524 beta_ch_b -0.23401 0.48676 0.17975 1.00000 0.49158 delta_a 0.25667 -0.04704 0.49524 0.49158 1.00000 gamma_commute_a -0.34074 0.40086 0.04628 0.13099 -0.25510 gamma_car_av_a -0.40213 0.30206 -0.35725 0.01591 -0.54371 gamma_commute_a gamma_car_av_a asc_1 0.03592 0.07982 beta_tt_a -0.17750 -0.27249 beta_tt_b 0.29838 0.26818 beta_tc_a -0.13933 -0.18647 beta_tc_b 0.21357 0.13345 beta_hw_a -0.34074 -0.40213 beta_hw_b 0.40086 0.30206 beta_ch_a 0.04628 -0.35725 beta_ch_b 0.13099 0.01591 delta_a -0.25510 -0.54371 gamma_commute_a 1.00000 0.02990 gamma_car_av_a 0.02990 1.00000 20 most extreme outliers in terms of lowest average per choice prediction: ID Avg prob per choice 15030 0.2304517 22580 0.3111378 14802 0.3317838 23205 0.3342205 20010 0.3385671 16489 0.3487431 16617 0.3580377 22961 0.3593967 15174 0.3730866 13863 0.3744502 18219 0.3756299 22278 0.3801851 76862 0.3860375 20100 0.3914965 13214 0.3958911 16178 0.3960674 20063 0.3994020 17187 0.4006440 20323 0.4039468 82613 0.4091424 Settings and functions used in model definition: apollo_control -------------- Value modelDescr "LC model with covariates in class allocation model on Swiss route choice data" indivID "ID" nCores "3" outputDirectory "output/" debug "FALSE" modelName "LC_with_covariates" workInLogs "FALSE" seed "13" mixing "FALSE" HB "FALSE" noValidation "FALSE" noDiagnostics "FALSE" calculateLLC "TRUE" analyticHessian "FALSE" memorySaver "FALSE" panelData "TRUE" analyticGrad "TRUE" analyticGrad_manualSet "FALSE" overridePanel "FALSE" preventOverridePanel "FALSE" noModification "FALSE" Hessian routines attempted -------------------------- numerical jacobian of LL analytical gradient Scaling used in computing Hessian --------------------------------- Value asc_1 0.03462614 beta_tt_a 0.20952585 beta_tt_b 0.03724378 beta_tc_a 0.77575358 beta_tc_b 0.04989429 beta_hw_a 0.05466507 beta_hw_b 0.03426122 beta_ch_a 2.67042820 beta_ch_b 0.60949028 delta_a 0.20947577 gamma_commute_a 0.43368924 gamma_car_av_a 0.58816419 apollo_lcPars --------------- function(apollo_beta, apollo_inputs){ lcpars = list() lcpars[["beta_tt"]] = list(beta_tt_a, beta_tt_b) lcpars[["beta_tc"]] = list(beta_tc_a, beta_tc_b) lcpars[["beta_hw"]] = list(beta_hw_a, beta_hw_b) lcpars[["beta_ch"]] = list(beta_ch_a, beta_ch_b) ### Utilities of class allocation model V=list() V[["class_a"]] = delta_a + gamma_commute_a*commute + gamma_car_av_a*car_availability V[["class_b"]] = delta_b + gamma_commute_b*commute + gamma_car_av_b*car_availability ### Settings for class allocation models classAlloc_settings = list( classes = c(class_a=1, class_b=2), utilities = V ) lcpars[["pi_values"]] = apollo_classAlloc(classAlloc_settings) return(lcpars) } 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() ### Define settings for MNL model component that are generic across classes mnl_settings = list( alternatives = c(alt1=1, alt2=2), avail = list(alt1=1, alt2=1), choiceVar = choice ) ### Loop over classes for(s in 1:2){ ### Compute class-specific utilities V=list() V[["alt1"]] = asc_1 + beta_tc[[s]]*tc1 + beta_tt[[s]]*tt1 + beta_hw[[s]]*hw1 + beta_ch[[s]]*ch1 V[["alt2"]] = asc_2 + beta_tc[[s]]*tc2 + beta_tt[[s]]*tt2 + beta_hw[[s]]*hw2 + beta_ch[[s]]*ch2 mnl_settings$utilities = V ### Compute within-class choice probabilities using MNL model P[[paste0("Class_",s)]] = apollo_mnl(mnl_settings, functionality) ### Take product across observation for same individual P[[paste0("Class_",s)]] = apollo_panelProd(P[[paste0("Class_",s)]], apollo_inputs ,functionality) } ### Compute latent class model probabilities lc_settings = list(inClassProb = P, classProb=pi_values) P[["model"]] = apollo_lc(lc_settings, apollo_inputs, functionality) ### Prepare and return outputs of function P = apollo_prepareProb(P, apollo_inputs, functionality) return(P) }