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_no_covariates Model description : Simple LC model on Swiss route choice data, no covariates in class allocation model Model run at : 2025-09-19 12:51:15.514981 Estimation method : bgw Estimation diagnosis : Relative function convergence Optimisation diagnosis : Maximum found hessian properties : Negative definite maximum eigenvalue : -14.024112 reciprocal of condition number : 8.30697e-05 Number of individuals : 388 Number of rows in database : 3492 Number of modelled outcomes : 3492 Number of cores used : 2 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) : -1562.08 Rho-squared vs equal shares : 0.3546 Adj.Rho-squared vs equal shares : 0.3505 Rho-squared vs observed shares : 0.3546 Adj.Rho-squared vs observed shares : 0.3513 AIC : 3144.16 BIC : 3205.74 LL(0,Class_1) : -2420.47 LL(final,Class_1) : -2513.86 LL(0,Class_2) : -2420.47 LL(final,Class_2) : -1769.69 Estimated parameters : 10 Time taken (hh:mm:ss) : 00:00:3.25 pre-estimation : 00:00:1.62 estimation : 00:00:0.72 post-estimation : 00:00:0.91 Iterations : 22 Unconstrained optimisation. Estimates: Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0) asc_1 -0.03522 0.047714 -0.7382 0.052970 -0.6649 asc_2 0.00000 NA NA NA NA beta_tt_a -0.21573 0.026447 -8.1571 0.050454 -4.2759 beta_tt_b -0.03754 0.005401 -6.9510 0.009742 -3.8532 beta_tc_a -0.79317 0.085615 -9.2644 0.119885 -6.6161 beta_tc_b -0.05105 0.013099 -3.8970 0.013426 -3.8021 beta_hw_a -0.05549 0.005634 -9.8493 0.008603 -6.4506 beta_hw_b -0.03454 0.003007 -11.4864 0.004578 -7.5456 beta_ch_a -2.77440 0.236531 -11.7296 0.312450 -8.8795 beta_ch_b -0.62690 0.072612 -8.6336 0.100287 -6.2511 delta_a 0.03374 0.175619 0.1921 0.198529 0.1700 delta_b 0.00000 NA NA NA NA Summary of class allocation for model component : Mean prob. Class_1 0.5084 Class_2 0.4916 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 beta_hw_a beta_hw_b asc_1 0.002277 -9.019e-05 1.835e-05 -1.5628e-04 1.527e-05 -1.773e-06 1.509e-06 beta_tt_a -9.019e-05 6.9946e-04 -3.562e-05 0.002034 -5.039e-06 6.539e-05 -3.840e-06 beta_tt_b 1.835e-05 -3.562e-05 2.917e-05 -3.701e-05 5.158e-05 -5.645e-06 4.801e-06 beta_tc_a -1.5628e-04 0.002034 -3.701e-05 0.007330 4.395e-05 1.7681e-04 1.579e-05 beta_tc_b 1.527e-05 -5.039e-06 5.158e-05 4.395e-05 1.7158e-04 -1.544e-06 5.228e-06 beta_hw_a -1.773e-06 6.539e-05 -5.645e-06 1.7681e-04 -1.544e-06 3.175e-05 -5.808e-06 beta_hw_b 1.509e-06 -3.840e-06 4.801e-06 1.579e-05 5.228e-06 -5.808e-06 9.043e-06 beta_ch_a -7.632e-06 0.004585 -6.642e-05 0.013643 3.1597e-04 5.9217e-04 -2.112e-05 beta_ch_b -3.435e-05 5.3414e-04 9.232e-05 0.002261 1.3901e-04 -2.702e-05 8.689e-05 delta_a -4.603e-05 0.001769 1.4915e-04 0.006586 4.0673e-04 4.454e-05 1.2299e-04 beta_ch_a beta_ch_b delta_a asc_1 -7.632e-06 -3.435e-05 -4.603e-05 beta_tt_a 0.004585 5.3414e-04 0.001769 beta_tt_b -6.642e-05 9.232e-05 1.4915e-04 beta_tc_a 0.013643 0.002261 0.006586 beta_tc_b 3.1597e-04 1.3901e-04 4.0673e-04 beta_hw_a 5.9217e-04 -2.702e-05 4.454e-05 beta_hw_b -2.112e-05 8.689e-05 1.2299e-04 beta_ch_a 0.055947 0.004558 0.019236 beta_ch_b 0.004558 0.005273 0.006950 delta_a 0.019236 0.006950 0.030842 Robust covariance matrix: asc_1 beta_tt_a beta_tt_b beta_tc_a beta_tc_b beta_hw_a beta_hw_b asc_1 0.002806 -5.0159e-04 5.202e-05 -0.001168 4.991e-05 -9.318e-06 -1.081e-05 beta_tt_a -5.0159e-04 0.002546 -3.2500e-04 0.005494 -1.7699e-04 2.1626e-04 -5.484e-05 beta_tt_b 5.202e-05 -3.2500e-04 9.491e-05 -5.5108e-04 8.025e-05 -4.157e-05 2.069e-05 beta_tc_a -0.001168 0.005494 -5.5108e-04 0.014372 -3.0200e-04 3.3197e-04 -2.621e-05 beta_tc_b 4.991e-05 -1.7699e-04 8.025e-05 -3.0200e-04 1.8025e-04 -2.226e-05 1.421e-05 beta_hw_a -9.318e-06 2.1626e-04 -4.157e-05 3.3197e-04 -2.226e-05 7.401e-05 -2.274e-05 beta_hw_b -1.081e-05 -5.484e-05 2.069e-05 -2.621e-05 1.421e-05 -2.274e-05 2.095e-05 beta_ch_a -6.6834e-04 0.012303 -0.001462 0.024543 -4.9226e-04 0.001454 -3.3569e-04 beta_ch_b -6.0613e-04 0.001189 1.2803e-04 0.004771 1.0323e-04 -1.7679e-04 2.1894e-04 delta_a -6.0862e-04 0.003718 -1.973e-05 0.011185 2.3560e-04 -9.218e-05 2.6375e-04 beta_ch_a beta_ch_b delta_a asc_1 -6.6834e-04 -6.0613e-04 -6.0862e-04 beta_tt_a 0.012303 0.001189 0.003718 beta_tt_b -0.001462 1.2803e-04 -1.973e-05 beta_tc_a 0.024543 0.004771 0.011185 beta_tc_b -4.9226e-04 1.0323e-04 2.3560e-04 beta_hw_a 0.001454 -1.7679e-04 -9.218e-05 beta_hw_b -3.3569e-04 2.1894e-04 2.6375e-04 beta_ch_a 0.097625 0.006565 0.026817 beta_ch_b 0.006565 0.010058 0.013081 delta_a 0.026817 0.013081 0.039414 Classical correlation matrix: asc_1 beta_tt_a beta_tt_b beta_tc_a beta_tc_b beta_hw_a beta_hw_b asc_1 1.000000 -0.07147 0.07122 -0.03826 0.02444 -0.006595 0.01052 beta_tt_a -0.071467 1.00000 -0.24941 0.89835 -0.01455 0.438840 -0.04828 beta_tt_b 0.071218 -0.24941 1.00000 -0.08005 0.72907 -0.185530 0.29561 beta_tc_a -0.038256 0.89835 -0.08005 1.00000 0.03919 0.366540 0.06134 beta_tc_b 0.024438 -0.01455 0.72907 0.03919 1.00000 -0.020924 0.13271 beta_hw_a -0.006595 0.43884 -0.18553 0.36654 -0.02092 1.000000 -0.34282 beta_hw_b 0.010518 -0.04828 0.29561 0.06134 0.13271 -0.342816 1.00000 beta_ch_a -6.7629e-04 0.73301 -0.05200 0.67369 0.10198 0.444344 -0.02969 beta_ch_b -0.009916 0.27814 0.23542 0.36366 0.14615 -0.066051 0.39795 delta_a -0.005494 0.38092 0.15726 0.43805 0.17681 0.045017 0.23289 beta_ch_a beta_ch_b delta_a asc_1 -6.7629e-04 -0.009916 -0.005494 beta_tt_a 0.73301 0.278139 0.380921 beta_tt_b -0.05200 0.235417 0.157260 beta_tc_a 0.67369 0.363656 0.438053 beta_tc_b 0.10198 0.146148 0.176807 beta_hw_a 0.44434 -0.066051 0.045017 beta_hw_b -0.02969 0.397950 0.232890 beta_ch_a 1.00000 0.265398 0.463085 beta_ch_b 0.26540 1.000000 0.544991 delta_a 0.46308 0.544991 1.000000 Robust correlation matrix: asc_1 beta_tt_a beta_tt_b beta_tc_a beta_tc_b beta_hw_a beta_hw_b asc_1 1.00000 -0.1877 0.10080 -0.18388 0.07018 -0.02045 -0.04458 beta_tt_a -0.18769 1.0000 -0.66119 0.90829 -0.26129 0.49823 -0.23745 beta_tt_b 0.10080 -0.6612 1.00000 -0.47183 0.61354 -0.49605 0.46394 beta_tc_a -0.18388 0.9083 -0.47183 1.00000 -0.18763 0.32188 -0.04776 beta_tc_b 0.07018 -0.2613 0.61354 -0.18763 1.00000 -0.19275 0.23115 beta_hw_a -0.02045 0.4982 -0.49605 0.32188 -0.19275 1.00000 -0.57750 beta_hw_b -0.04458 -0.2375 0.46394 -0.04776 0.23115 -0.57750 1.00000 beta_ch_a -0.04038 0.7804 -0.48033 0.65523 -0.11735 0.54076 -0.23471 beta_ch_b -0.11410 0.2351 0.13104 0.39682 0.07667 -0.20492 0.47691 delta_a -0.05788 0.3712 -0.01020 0.46993 0.08839 -0.05397 0.29022 beta_ch_a beta_ch_b delta_a asc_1 -0.04038 -0.11410 -0.05788 beta_tt_a 0.78042 0.23506 0.37117 beta_tt_b -0.48033 0.13104 -0.01020 beta_tc_a 0.65523 0.39682 0.46993 beta_tc_b -0.11735 0.07667 0.08839 beta_hw_a 0.54076 -0.20492 -0.05397 beta_hw_b -0.23471 0.47691 0.29022 beta_ch_a 1.00000 0.20953 0.43232 beta_ch_b 0.20953 1.00000 0.65699 delta_a 0.43232 0.65699 1.00000 20 most extreme outliers in terms of lowest average per choice prediction: ID Avg prob per choice 15030 0.2252196 22580 0.3139471 20010 0.3315774 23205 0.3323225 14802 0.3426333 16617 0.3493284 16489 0.3503707 22961 0.3618753 18219 0.3738197 15174 0.3754398 13863 0.3759124 22278 0.3819353 13214 0.3835182 16178 0.3863263 76862 0.3891236 20100 0.3930307 20063 0.4036284 20323 0.4050271 17187 0.4057538 22820 0.4085196 Settings and functions used in model definition: apollo_control -------------- Value modelDescr "Simple LC model on Swiss route choice data, no covariates in class allocation model" indivID "ID" nCores "2" outputDirectory "output/" debug "FALSE" modelName "LC_no_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.03522009 beta_tt_a 0.21573267 beta_tt_b 0.03753925 beta_tc_a 0.79317334 beta_tc_b 0.05104616 beta_hw_a 0.05549358 beta_hw_b 0.03454082 beta_ch_a 2.77440469 beta_ch_b 0.62690276 delta_a 0.03374005 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) V=list() V[["class_a"]] = delta_a V[["class_b"]] = delta_b 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_tt[[s]]*tt1 + beta_tc[[s]]*tc1 + beta_hw[[s]]*hw1 + beta_ch[[s]]*ch1 V[["alt2"]] = asc_2 + beta_tt[[s]]*tt2 + beta_tc[[s]]*tc2 + 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) }