Model run by stephane.hess using Apollo 0.3.5 on R 4.4.0 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 : EM_LC_no_covariates Model description : LC model with constant class allocation probabilities on Swiss route choice data, EM algorithm Model run at : 2025-03-10 21:16:23.617874 Estimation method : EM algorithm (bfgs) -> Maximum likelihood (bfgs) Model diagnosis : successful convergence Optimisation diagnosis : Maximum found hessian properties : Negative definite maximum eigenvalue : -15.03757 reciprocal of condition number : 8.92471e-05 Number of individuals : 388 Number of rows in database : 3492 Number of modelled outcomes : 3492 Number of cores used : 1 Model without mixing LL(start) : -1755.5 LL (whole model) at equal shares, LL(0) : -2420.47 LL (whole model) at observed shares, LL(C) : -2420.39 LL(final, whole model) : -1561.79 Rho-squared vs equal shares : 0.3548 Adj.Rho-squared vs equal shares : 0.3502 Rho-squared vs observed shares : 0.3547 Adj.Rho-squared vs observed shares : 0.351 AIC : 3145.57 BIC : 3213.31 LL(0,Class_1) : -2420.47 LL(final,Class_1) : -1770.94 LL(0,Class_2) : -2420.47 LL(final,Class_2) : -2511.9 Estimated parameters : 11 Time taken (hh:mm:ss) : 00:00:11.31 pre-estimation : 00:00:0.23 estimation : 00:00:9.36 post-estimation : 00:00:1.72 Iterations : 47 (EM) & 2 (bfgs) Unconstrained optimisation. Estimates: Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0) asc_1_a -0.06752 0.064325 -1.0497 0.075052 -0.8997 asc_1_b 0.04101 0.110416 0.3715 0.133251 0.3078 asc_2_a 0.00000 NA NA NA NA asc_2_b 0.00000 NA NA NA NA beta_tt_a -0.03718 0.005258 -7.0716 0.008957 -4.1513 beta_tt_b -0.21767 0.025462 -8.5488 0.045306 -4.8044 beta_tc_a -0.05051 0.013044 -3.8726 0.013173 -3.8346 beta_tc_b -0.79771 0.084776 -9.4096 0.114050 -6.9944 beta_hw_a -0.03448 0.002994 -11.5157 0.004497 -7.6671 beta_hw_b -0.05553 0.005511 -10.0775 0.008090 -6.8650 beta_ch_a -0.62572 0.072964 -8.5757 0.102236 -6.1203 beta_ch_b -2.75525 0.227180 -12.1281 0.280574 -9.8200 delta_a -0.04478 0.174652 -0.2564 0.198420 -0.2257 delta_b 0.00000 NA NA NA NA Summary of class allocation for model component : Mean prob. Class_1 0.4888 Class_2 0.5112 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_a asc_1_b beta_tt_a beta_tt_b beta_tc_a beta_tc_b beta_hw_a beta_hw_b beta_ch_a beta_ch_b asc_1_a 0.004138 -0.001974 -2.048e-06 -1.372e-05 -2.316e-05 -5.329e-06 -1.399e-06 -3.659e-06 -1.2824e-04 -0.001445 asc_1_b -0.001974 0.012192 5.339e-05 -4.7527e-04 6.729e-05 -0.001266 3.729e-06 -1.955e-05 -3.4272e-04 7.7071e-04 beta_tt_a -2.048e-06 5.339e-05 2.765e-05 -2.635e-05 5.052e-05 -1.671e-05 4.411e-06 -4.491e-06 9.270e-05 -1.484e-05 beta_tt_b -1.372e-05 -4.7527e-04 -2.635e-05 6.4830e-04 -3.517e-07 0.001938 -8.123e-07 5.684e-05 5.4618e-04 0.004092 beta_tc_a -2.316e-05 6.729e-05 5.052e-05 -3.517e-07 1.7014e-04 5.344e-05 5.037e-06 -1.117e-06 1.3771e-04 3.2893e-04 beta_tc_b -5.329e-06 -0.001266 -1.671e-05 0.001938 5.344e-05 0.007187 2.340e-05 1.5668e-04 0.002322 0.012403 beta_hw_a -1.399e-06 3.729e-06 4.411e-06 -8.123e-07 5.037e-06 2.340e-05 8.963e-06 -5.438e-06 8.830e-05 -6.927e-06 beta_hw_b -3.659e-06 -1.955e-05 -4.491e-06 5.684e-05 -1.117e-06 1.5668e-04 -5.438e-06 3.037e-05 -2.923e-05 5.3043e-04 beta_ch_a -1.2824e-04 -3.4272e-04 9.270e-05 5.4618e-04 1.3771e-04 0.002322 8.830e-05 -2.923e-05 0.005324 0.004236 beta_ch_b -0.001445 7.7071e-04 -1.484e-05 0.004092 3.2893e-04 0.012403 -6.927e-06 5.3043e-04 0.004236 0.051611 delta_a 9.0509e-04 -1.1523e-04 -1.6093e-04 -0.001683 -4.0858e-04 -0.006416 -1.2738e-04 -2.961e-05 -0.006922 -0.017891 delta_a asc_1_a 9.0509e-04 asc_1_b -1.1523e-04 beta_tt_a -1.6093e-04 beta_tt_b -0.001683 beta_tc_a -4.0858e-04 beta_tc_b -0.006416 beta_hw_a -1.2738e-04 beta_hw_b -2.961e-05 beta_ch_a -0.006922 beta_ch_b -0.017891 delta_a 0.030503 Robust covariance matrix: asc_1_a asc_1_b beta_tt_a beta_tt_b beta_tc_a beta_tc_b beta_hw_a beta_hw_b beta_ch_a beta_ch_b asc_1_a 0.005633 -0.003586 -8.942e-05 2.0524e-04 -7.128e-05 5.0527e-04 -3.986e-05 2.251e-05 -8.1280e-04 -0.002659 asc_1_b -0.003586 0.017756 3.5426e-04 -0.002371 2.8590e-04 -0.005915 4.072e-05 -9.185e-05 -0.001145 8.1009e-04 beta_tt_a -8.942e-05 3.5426e-04 8.023e-05 -2.3703e-04 7.200e-05 -3.7532e-04 1.703e-05 -3.049e-05 1.3431e-04 -9.0867e-04 beta_tt_b 2.0524e-04 -0.002371 -2.3703e-04 0.002053 -1.3163e-04 0.004602 -2.950e-05 1.4472e-04 0.001262 0.008867 beta_tc_a -7.128e-05 2.8590e-04 7.200e-05 -1.3163e-04 1.7353e-04 -2.1497e-04 1.252e-05 -1.684e-05 1.0481e-04 -2.0260e-04 beta_tc_b 5.0527e-04 -0.005915 -3.7532e-04 0.004602 -2.1497e-04 0.013007 3.020e-05 1.8218e-04 0.005153 0.017431 beta_hw_a -3.986e-05 4.072e-05 1.703e-05 -2.950e-05 1.252e-05 3.020e-05 2.022e-05 -1.997e-05 2.2901e-04 -1.9429e-04 beta_hw_b 2.251e-05 -9.185e-05 -3.049e-05 1.4472e-04 -1.684e-05 1.8218e-04 -1.997e-05 6.544e-05 -1.9062e-04 0.001046 beta_ch_a -8.1280e-04 -0.001145 1.3431e-04 0.001262 1.0481e-04 0.005153 2.2901e-04 -1.9062e-04 0.010452 0.006057 beta_ch_b -0.002659 8.1009e-04 -9.0867e-04 0.008867 -2.0260e-04 0.017431 -1.9429e-04 0.001046 0.006057 0.078722 delta_a 0.002127 4.7609e-04 -1.0299e-04 -0.003157 -2.9566e-04 -0.010354 -3.0690e-04 1.8831e-04 -0.013508 -0.022791 delta_a asc_1_a 0.002127 asc_1_b 4.7609e-04 beta_tt_a -1.0299e-04 beta_tt_b -0.003157 beta_tc_a -2.9566e-04 beta_tc_b -0.010354 beta_hw_a -3.0690e-04 beta_hw_b 1.8831e-04 beta_ch_a -0.013508 beta_ch_b -0.022791 delta_a 0.039370 Classical correlation matrix: asc_1_a asc_1_b beta_tt_a beta_tt_b beta_tc_a beta_tc_b beta_hw_a beta_hw_b beta_ch_a beta_ch_b asc_1_a 1.000000 -0.277884 -0.006055 -0.008375 -0.027598 -9.7720e-04 -0.007264 -0.01032 -0.02732 -0.09889 asc_1_b -0.277884 1.000000 0.091955 -0.169051 0.046720 -0.13526 0.011282 -0.03213 -0.04254 0.03072 beta_tt_a -0.006055 0.091955 1.000000 -0.196814 0.736565 -0.03750 0.280199 -0.15499 0.24163 -0.01242 beta_tt_b -0.008375 -0.169051 -0.196814 1.000000 -0.001059 0.89772 -0.010656 0.40507 0.29399 0.70744 beta_tc_a -0.027598 0.046720 0.736565 -0.001059 1.000000 0.04832 0.128981 -0.01554 0.14470 0.11100 beta_tc_b -9.7720e-04 -0.135260 -0.037496 0.897719 0.048323 1.00000 0.092184 0.33538 0.37540 0.64399 beta_hw_a -0.007264 0.011282 0.280199 -0.010656 0.128981 0.09218 1.000000 -0.32963 0.40424 -0.01018 beta_hw_b -0.010323 -0.032132 -0.154993 0.405072 -0.015539 0.33538 -0.329628 1.00000 -0.07269 0.42369 beta_ch_a -0.027323 -0.042541 0.241627 0.293995 0.144699 0.37540 0.404239 -0.07269 1.00000 0.25557 beta_ch_b -0.098890 0.030725 -0.012422 0.707440 0.111002 0.64399 -0.010184 0.42369 0.25557 1.00000 delta_a 0.080563 -0.005975 -0.175241 -0.378469 -0.179351 -0.43333 -0.243608 -0.03076 -0.54316 -0.45092 delta_a asc_1_a 0.080563 asc_1_b -0.005975 beta_tt_a -0.175241 beta_tt_b -0.378469 beta_tc_a -0.179351 beta_tc_b -0.433333 beta_hw_a -0.243608 beta_hw_b -0.030760 beta_ch_a -0.543161 beta_ch_b -0.450922 delta_a 1.000000 Robust correlation matrix: asc_1_a asc_1_b beta_tt_a beta_tt_b beta_tc_a beta_tc_b beta_hw_a beta_hw_b beta_ch_a beta_ch_b asc_1_a 1.00000 -0.35856 -0.13301 0.06036 -0.07210 0.05903 -0.11810 0.03708 -0.10593 -0.12629 asc_1_b -0.35856 1.00000 0.29681 -0.39282 0.16288 -0.38924 0.06797 -0.08521 -0.08407 0.02167 beta_tt_a -0.13301 0.29681 1.00000 -0.58408 0.61019 -0.36739 0.42272 -0.42077 0.14666 -0.36156 beta_tt_b 0.06036 -0.39282 -0.58408 1.00000 -0.22055 0.89067 -0.14479 0.39488 0.27238 0.69752 beta_tc_a -0.07210 0.16288 0.61019 -0.22055 1.00000 -0.14308 0.21135 -0.15799 0.07782 -0.05481 beta_tc_b 0.05903 -0.38924 -0.36739 0.89067 -0.14308 1.00000 0.05889 0.19746 0.44197 0.54471 beta_hw_a -0.11810 0.06797 0.42272 -0.14479 0.21135 0.05889 1.00000 -0.54896 0.49816 -0.15400 beta_hw_b 0.03708 -0.08521 -0.42077 0.39488 -0.15799 0.19746 -0.54896 1.00000 -0.23048 0.46094 beta_ch_a -0.10593 -0.08407 0.14666 0.27238 0.07782 0.44197 0.49816 -0.23048 1.00000 0.21117 beta_ch_b -0.12629 0.02167 -0.36156 0.69752 -0.05481 0.54471 -0.15400 0.46094 0.21117 1.00000 delta_a 0.14283 0.01801 -0.05795 -0.35115 -0.11312 -0.45753 -0.34397 0.11732 -0.66589 -0.40939 delta_a asc_1_a 0.14283 asc_1_b 0.01801 beta_tt_a -0.05795 beta_tt_b -0.35115 beta_tc_a -0.11312 beta_tc_b -0.45753 beta_hw_a -0.34397 beta_hw_b 0.11732 beta_ch_a -0.66589 beta_ch_b -0.40939 delta_a 1.00000 20 most extreme outliers in terms of lowest average per choice prediction: ID Avg prob per choice 15030 0.2279271 22580 0.3124157 20010 0.3355578 23205 0.3385695 14802 0.3396943 16489 0.3502837 16617 0.3506096 22961 0.3618898 18219 0.3706847 13863 0.3760176 15174 0.3794903 22278 0.3826137 13214 0.3862442 16178 0.3870932 76862 0.3880124 20100 0.3885913 20323 0.4042100 17187 0.4058210 20063 0.4068230 22820 0.4119228 Changes in parameter estimates from starting values: Initial Estimate Difference asc_1_a -0.06752 -0.06752 -1.123e-06 asc_1_b 0.04101 0.04101 2.785e-07 asc_2_a 0.00000 0.00000 0.000 asc_2_b 0.00000 0.00000 0.000 beta_tt_a -0.03719 -0.03718 7.035e-06 beta_tt_b -0.21766 -0.21767 -5.026e-06 beta_tc_a -0.05052 -0.05051 7.263e-06 beta_tc_b -0.79771 -0.79771 6.285e-07 beta_hw_a -0.03446 -0.03448 -1.744e-05 beta_hw_b -0.05553 -0.05553 -4.334e-06 beta_ch_a -0.62572 -0.62572 -5.158e-07 beta_ch_b -2.75525 -2.75525 -3.819e-07 delta_a -0.04478 -0.04478 -2.288e-08 delta_b 0.00000 0.00000 0.000 Settings and functions used in model definition: apollo_control -------------- Value modelDescr "LC model with constant class allocation probabilities on Swiss route choice data, EM algorithm" indivID "ID" noValidation "TRUE" noDiagnostics "TRUE" outputDirectory "output/" debug "FALSE" modelName "EM_LC_no_covariates" nCores "1" workInLogs "FALSE" seed "13" mixing "FALSE" HB "FALSE" calculateLLC "TRUE" analyticHessian "FALSE" memorySaver "FALSE" panelData "TRUE" analyticGrad "FALSE" analyticGrad_manualSet "FALSE" overridePanel "FALSE" preventOverridePanel "FALSE" noModification "FALSE" Hessian routines attempted -------------------------- numerical second derivative of LL (using numDeriv) apollo_lcPars --------------- function(apollo_beta, apollo_inputs){ lcpars = list() lcpars[["asc_1" ]] = list( asc_1_a, asc_1_b) lcpars[["asc_2" ]] = list( asc_2_a, asc_2_b) 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) lcpars[["pi_values"]] = list(class_a = 1/(1 + exp(delta_b - delta_a)), class_b = 1/(1 + exp(delta_a - delta_b))) 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:length(pi_values)){ ### Compute class-specific utilities V=list() V[["alt1"]] = asc_1[[s]] + beta_tc[[s]]*tc1 + beta_tt[[s]]*tt1 + beta_hw[[s]]*hw1 + beta_ch[[s]]*ch1 V[["alt2"]] = asc_2[[s]] + beta_tc[[s]]*tc2 + beta_tt[[s]]*tt2 + beta_hw[[s]]*hw2 + beta_ch[[s]]*ch2 mnl_settings$utilities = V mnl_settings$componentName = paste0("Class_",s) ### 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) }