Model run by stephane.hess using Apollo 0.3.4 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 : LC_no_covariates Model description : Simple LC model on Swiss route choice data, no covariates in class allocation model Model run at : 2024-09-30 13:33:41.508824 Estimation method : bgw Model diagnosis : Relative function convergence Optimisation diagnosis : Maximum found hessian properties : Negative definite maximum eigenvalue : -14.025265 reciprocal of condition number : 8.30767e-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) : -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) : -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) : -1769.69 LL(0,Class_2) : -2420.47 LL(final,Class_2) : -2513.84 Estimated parameters : 10 Time taken (hh:mm:ss) : 00:00:2.24 pre-estimation : 00:00:1.48 estimation : 00:00:0.29 post-estimation : 00:00:0.47 Iterations : 26 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.053038 -0.6641 asc_2 0.00000 NA NA NA NA beta_tt_a -0.03754 0.005400 -6.9510 0.009754 -3.8484 beta_tt_b -0.21573 0.026446 -8.1573 0.050515 -4.2707 beta_tc_a -0.05105 0.013099 -3.8970 0.013443 -3.7972 beta_tc_b -0.79317 0.085613 -9.2646 0.120032 -6.6080 beta_hw_a -0.03454 0.003007 -11.4863 0.004583 -7.5360 beta_hw_b -0.05549 0.005634 -9.8495 0.008614 -6.4426 beta_ch_a -0.62689 0.072612 -8.6334 0.100416 -6.2430 beta_ch_b -2.77437 0.236520 -11.7300 0.312822 -8.8689 delta_a -0.03376 0.175617 -0.1923 0.198781 -0.1699 delta_b 0.00000 NA NA NA NA Summary of class allocation for model component : Mean prob. Class_1 0.4916 Class_2 0.5084 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 1.835e-05 -9.018e-05 1.527e-05 -1.5626e-04 1.509e-06 -1.772e-06 beta_tt_a 1.835e-05 2.917e-05 -3.562e-05 5.157e-05 -3.700e-05 4.800e-06 -5.645e-06 beta_tt_b -9.018e-05 -3.562e-05 6.9941e-04 -5.038e-06 0.002034 -3.838e-06 6.539e-05 beta_tc_a 1.527e-05 5.157e-05 -5.038e-06 1.7158e-04 4.395e-05 5.227e-06 -1.544e-06 beta_tc_b -1.5626e-04 -3.700e-05 0.002034 4.395e-05 0.007330 1.580e-05 1.7680e-04 beta_hw_a 1.509e-06 4.800e-06 -3.838e-06 5.227e-06 1.580e-05 9.043e-06 -5.808e-06 beta_hw_b -1.772e-06 -5.645e-06 6.539e-05 -1.544e-06 1.7680e-04 -5.808e-06 3.174e-05 beta_ch_a -3.435e-05 9.232e-05 5.3413e-04 1.3900e-04 0.002261 8.689e-05 -2.702e-05 beta_ch_b -7.589e-06 -6.640e-05 0.004585 3.1596e-04 0.013641 -2.110e-05 5.9213e-04 delta_a 4.602e-05 -1.4915e-04 -0.001769 -4.0671e-04 -0.006586 -1.2299e-04 -4.455e-05 beta_ch_a beta_ch_b delta_a asc_1 -3.435e-05 -7.589e-06 4.602e-05 beta_tt_a 9.232e-05 -6.640e-05 -1.4915e-04 beta_tt_b 5.3413e-04 0.004585 -0.001769 beta_tc_a 1.3900e-04 3.1596e-04 -4.0671e-04 beta_tc_b 0.002261 0.013641 -0.006586 beta_hw_a 8.689e-05 -2.110e-05 -1.2299e-04 beta_hw_b -2.702e-05 5.9213e-04 -4.455e-05 beta_ch_a 0.005273 0.004558 -0.006950 beta_ch_b 0.004558 0.055942 -0.019235 delta_a -0.006950 -0.019235 0.030841 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.002813 5.214e-05 -5.0282e-04 5.003e-05 -0.001171 -1.084e-05 -9.336e-06 beta_tt_a 5.214e-05 9.515e-05 -3.2578e-04 8.045e-05 -5.5239e-04 2.074e-05 -4.167e-05 beta_tt_b -5.0282e-04 -3.2578e-04 0.002552 -1.7742e-04 0.005507 -5.497e-05 2.1677e-04 beta_tc_a 5.003e-05 8.045e-05 -1.7742e-04 1.8071e-04 -3.0273e-04 1.424e-05 -2.232e-05 beta_tc_b -0.001171 -5.5239e-04 0.005507 -3.0273e-04 0.014408 -2.625e-05 3.3275e-04 beta_hw_a -1.084e-05 2.074e-05 -5.497e-05 1.424e-05 -2.625e-05 2.101e-05 -2.280e-05 beta_hw_b -9.336e-06 -4.167e-05 2.1677e-04 -2.232e-05 3.3275e-04 -2.280e-05 7.419e-05 beta_ch_a -6.0769e-04 1.2835e-04 0.001192 1.0349e-04 0.004783 2.1949e-04 -1.7723e-04 beta_ch_b -6.6970e-04 -0.001466 0.012332 -4.9342e-04 0.024601 -3.3646e-04 0.001457 delta_a 6.1010e-04 1.973e-05 -0.003727 -2.3621e-04 -0.011212 -2.6444e-04 9.244e-05 beta_ch_a beta_ch_b delta_a asc_1 -6.0769e-04 -6.6970e-04 6.1010e-04 beta_tt_a 1.2835e-04 -0.001466 1.973e-05 beta_tt_b 0.001192 0.012332 -0.003727 beta_tc_a 1.0349e-04 -4.9342e-04 -2.3621e-04 beta_tc_b 0.004783 0.024601 -0.011212 beta_hw_a 2.1949e-04 -3.3646e-04 -2.6444e-04 beta_hw_b -1.7723e-04 0.001457 9.244e-05 beta_ch_a 0.010083 0.006582 -0.013114 beta_ch_b 0.006582 0.097857 -0.026881 delta_a -0.013114 -0.026881 0.039514 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.07122 -0.07146 0.02444 -0.03825 0.01052 -0.006593 beta_tt_a 0.071215 1.00000 -0.24939 0.72908 -0.08003 0.29560 -0.185510 beta_tt_b -0.071464 -0.24939 1.00000 -0.01454 0.89835 -0.04826 0.438831 beta_tc_a 0.024437 0.72908 -0.01454 1.00000 0.03919 0.13271 -0.020918 beta_tc_b -0.038252 -0.08003 0.89835 0.03919 1.00000 0.06136 0.366536 beta_hw_a 0.010516 0.29560 -0.04826 0.13271 0.06136 1.00000 -0.342803 beta_hw_b -0.006593 -0.18551 0.43883 -0.02092 0.36654 -0.34280 1.000000 beta_ch_a -0.009915 0.23542 0.27814 0.14614 0.36366 0.39795 -0.066038 beta_ch_b -6.7245e-04 -0.05198 0.73300 0.10198 0.67368 -0.02967 0.444344 delta_a 0.005492 -0.15727 -0.38092 -0.17680 -0.43805 -0.23290 -0.045023 beta_ch_a beta_ch_b delta_a asc_1 -0.009915 -6.7245e-04 0.005492 beta_tt_a 0.235415 -0.05198 -0.157265 beta_tt_b 0.278145 0.73300 -0.380916 beta_tc_a 0.146145 0.10198 -0.176805 beta_tc_b 0.363659 0.67368 -0.438047 beta_hw_a 0.397948 -0.02967 -0.232896 beta_hw_b -0.066038 0.44434 -0.045023 beta_ch_a 1.000000 0.26539 -0.544988 beta_ch_b 0.265395 1.00000 -0.463074 delta_a -0.544988 -0.46307 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.10079 -0.1877 0.07017 -0.18387 -0.04459 -0.02043 beta_tt_a 0.10079 1.00000 -0.6612 0.61354 -0.47179 0.46391 -0.49601 beta_tt_b -0.18767 -0.66116 1.0000 -0.26127 0.90828 -0.23740 0.49819 beta_tc_a 0.07017 0.61354 -0.2613 1.00000 -0.18761 0.23113 -0.19273 beta_tc_b -0.18387 -0.47179 0.9083 -0.18761 1.00000 -0.04771 0.32183 beta_hw_a -0.04459 0.46391 -0.2374 0.23113 -0.04771 1.00000 -0.57748 beta_hw_b -0.02043 -0.49601 0.4982 -0.19273 0.32183 -0.57748 1.00000 beta_ch_a -0.11410 0.13104 0.2351 0.07666 0.39684 0.47691 -0.20490 beta_ch_b -0.04036 -0.48029 0.7804 -0.11733 0.65518 -0.23467 0.54074 delta_a 0.05787 0.01018 -0.3712 -0.08839 -0.46992 -0.29025 0.05399 beta_ch_a beta_ch_b delta_a asc_1 -0.11410 -0.04036 0.05787 beta_tt_a 0.13104 -0.48029 0.01018 beta_tt_b 0.23508 0.78040 -0.37115 beta_tc_a 0.07666 -0.11733 -0.08839 beta_tc_b 0.39684 0.65518 -0.46992 beta_hw_a 0.47691 -0.23467 -0.29025 beta_hw_b -0.20490 0.54074 0.05399 beta_ch_a 1.00000 0.20953 -0.65699 beta_ch_b 0.20953 1.00000 -0.43229 delta_a -0.65699 -0.43229 1.00000 20 most extreme outliers in terms of lowest average per choice prediction: ID Avg prob per choice 15030 0.2252228 22580 0.3139488 20010 0.3315796 23205 0.3323246 14802 0.3426353 16617 0.3493312 16489 0.3503727 22961 0.3618768 18219 0.3738213 15174 0.3754410 13863 0.3759139 22278 0.3819369 13214 0.3835192 16178 0.3863278 76862 0.3891245 20100 0.3930323 20063 0.4036293 20323 0.4050283 17187 0.4057551 22820 0.4085204 Changes in parameter estimates from starting values: Initial Estimate Difference asc_1 0.00000 -0.03522 -0.035220 asc_2 0.00000 0.00000 0.000000 beta_tt_a 0.00000 -0.03754 -0.037539 beta_tt_b 0.00000 -0.21573 -0.215731 beta_tc_a 0.00000 -0.05105 -0.051046 beta_tc_b 0.00000 -0.79317 -0.793170 beta_hw_a -0.03960 -0.03454 0.005060 beta_hw_b -0.04790 -0.05549 -0.007594 beta_ch_a -0.76240 -0.62689 0.135508 beta_ch_b -2.17250 -2.77437 -0.601874 delta_a 0.03290 -0.03376 -0.066665 delta_b 0.00000 0.00000 0.000000 Settings and functions used in model definition: apollo_control -------------- Value modelName "LC_no_covariates" modelDescr "Simple LC model on Swiss route choice data, no covariates in class allocation model" indivID "ID" nCores "2" outputDirectory "output/" debug "FALSE" 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.03522011 beta_tt_a 0.03753874 beta_tt_b 0.21573147 beta_tc_a 0.05104586 beta_tc_b 0.79316996 beta_hw_a 0.03454032 beta_hw_b 0.05549411 beta_ch_a 0.62689233 beta_ch_b 2.77437411 delta_a 0.03376453 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 #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) }