Model run by stephane.hess using Apollo 0.2.7 on R 4.0.5 for Darwin. 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 : 2022-01-07 20:40:09 Estimation method : bfgs Model diagnosis : successful convergence 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(0, whole model) : -2420.47 LL(C, whole model) : -2420.39 LL(final, whole model) : -1564.1 Rho-square (0) : 0.3538 Adj.Rho-square (0) : 0.3497 Rho-square (C) : 0.3538 Adj.Rho-square (C) : 0.3497 AIC : 3148.2 BIC : 3209.78 LL(0,Class_1) : -2420.47 LL(final,Class_1) : -1780.85 LL(0,Class_2) : -2420.47 LL(final,Class_2) : -2324.26 Estimated parameters : 10 Time taken (hh:mm:ss) : 00:00:8 pre-estimation : 00:00:6.5 estimation : 00:00:0.85 post-estimation : 00:00:0.64 Iterations : 25 Min abs eigenvalue of Hessian : 10.78543 Unconstrained optimisation. Estimates: Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0) asc_1 -0.04479 0.048013 -0.9330 0.052742 -0.84932 asc_2 0.00000 NA NA NA NA beta_tt_a -0.07353 0.008561 -8.5890 0.018045 -4.07495 beta_tt_b -0.09781 0.014162 -6.9070 0.030556 -3.20114 beta_tc_a -0.09568 0.016253 -5.8871 0.024269 -3.94258 beta_tc_b -0.53392 0.093863 -5.6883 0.257886 -2.07037 beta_hw_a -0.03964 0.003895 -10.1764 0.007958 -4.98085 beta_hw_b -0.04747 0.005678 -8.3599 0.010496 -4.52232 beta_ch_a -0.76404 0.105085 -7.2707 0.284348 -2.68698 beta_ch_b -2.16743 0.184899 -11.7223 0.290223 -7.46816 delta_a 0.03946 0.268045 0.1472 0.688159 0.05734 delta_b 0.00000 NA NA NA NA Summary of class allocation for LC model component : Mean prob. Class_1 0.7311 Class_2 0.2689 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 beta_ch_a beta_ch_b asc_1 0.002305 1.913e-05 -1.907e-05 1.027e-05 -2.6784e-04 -5.738e-06 1.045e-05 -3.0938e-04 -5.710e-05 beta_tt_a 1.913e-05 7.329e-05 -5.307e-05 1.0775e-04 -4.2070e-04 4.105e-06 -2.364e-06 -9.674e-05 -6.2586e-04 beta_tt_b -1.907e-05 -5.307e-05 2.0055e-04 -7.281e-05 0.001025 7.759e-06 -1.842e-06 1.8120e-04 9.0061e-04 beta_tc_a 1.027e-05 1.0775e-04 -7.281e-05 2.6416e-04 -4.3284e-04 4.496e-06 1.457e-06 1.187e-06 -3.9381e-04 beta_tc_b -2.6784e-04 -4.2070e-04 0.001025 -4.3284e-04 0.008810 8.214e-05 -8.631e-06 0.005111 0.008589 beta_hw_a -5.738e-06 4.105e-06 7.759e-06 4.496e-06 8.214e-05 1.517e-05 -1.254e-05 1.8478e-04 -8.948e-05 beta_hw_b 1.045e-05 -2.364e-06 -1.842e-06 1.457e-06 -8.631e-06 -1.254e-05 3.224e-05 -1.4466e-04 3.7157e-04 beta_ch_a -3.0938e-04 -9.674e-05 1.8120e-04 1.187e-06 0.005111 1.8478e-04 -1.4466e-04 0.011043 0.003719 beta_ch_b -5.710e-05 -6.2586e-04 9.0061e-04 -3.9381e-04 0.008589 -8.948e-05 3.7157e-04 0.003719 0.034188 delta_a 8.4344e-04 7.8479e-04 -7.0963e-04 3.6302e-04 -0.015304 -2.7082e-04 1.6986e-04 -0.020234 -0.024141 delta_a asc_1 8.4344e-04 beta_tt_a 7.8479e-04 beta_tt_b -7.0963e-04 beta_tc_a 3.6302e-04 beta_tc_b -0.01530 beta_hw_a -2.7082e-04 beta_hw_b 1.6986e-04 beta_ch_a -0.02023 beta_ch_b -0.02414 delta_a 0.07185 Robust covariance matrix: asc_1 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 0.002782 8.300e-05 -1.7129e-04 4.238e-05 -0.002629 -9.733e-05 1.1583e-04 -0.003372 7.430e-05 beta_tt_a 8.300e-05 3.2562e-04 -3.5745e-04 3.5889e-04 -0.003557 -4.903e-05 5.700e-05 -0.002407 -0.003254 beta_tt_b -1.7129e-04 -3.5745e-04 9.3367e-04 -4.4272e-04 0.005591 1.0399e-04 -1.3125e-04 0.002400 0.003406 beta_tc_a 4.238e-05 3.5889e-04 -4.4272e-04 5.8900e-04 -0.003279 -4.522e-05 6.574e-05 -0.001499 -0.002419 beta_tc_b -0.002629 -0.003557 0.005591 -0.003279 0.066505 0.001344 -0.001457 0.059735 0.038901 beta_hw_a -9.733e-05 -4.903e-05 1.0399e-04 -4.522e-05 0.001344 6.332e-05 -6.838e-05 0.001595 2.0372e-04 beta_hw_b 1.1583e-04 5.700e-05 -1.3125e-04 6.574e-05 -0.001457 -6.838e-05 1.1017e-04 -0.001663 2.5997e-04 beta_ch_a -0.003372 -0.002407 0.002400 -0.001499 0.059735 0.001595 -0.001663 0.080854 0.028984 beta_ch_b 7.430e-05 -0.003254 0.003406 -0.002419 0.038901 2.0372e-04 2.5997e-04 0.028984 0.084229 delta_a 0.006930 0.007819 -0.006967 0.005299 -0.153288 -0.003459 0.003550 -0.182567 -0.107885 delta_a asc_1 0.006930 beta_tt_a 0.007819 beta_tt_b -0.006967 beta_tc_a 0.005299 beta_tc_b -0.153288 beta_hw_a -0.003459 beta_hw_b 0.003550 beta_ch_a -0.182567 beta_ch_b -0.107885 delta_a 0.473563 Classical correlation matrix: asc_1 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 1.000000 0.04654 -0.02805 0.01316 -0.05943 -0.03068 0.03832 -0.06132 -0.006432 beta_tt_a 0.046545 1.00000 -0.43772 0.77435 -0.52353 0.12312 -0.04863 -0.10753 -0.395375 beta_tt_b -0.028048 -0.43772 1.00000 -0.31633 0.77093 0.14067 -0.02291 0.12176 0.343944 beta_tc_a 0.013160 0.77435 -0.31633 1.00000 -0.28373 0.07103 0.01579 6.9522e-04 -0.131044 beta_tc_b -0.059431 -0.52353 0.77093 -0.28373 1.00000 0.22468 -0.01619 0.51820 0.494889 beta_hw_a -0.030685 0.12312 0.14067 0.07103 0.22468 1.00000 -0.56709 0.45148 -0.124252 beta_hw_b 0.038317 -0.04863 -0.02291 0.01579 -0.01619 -0.56709 1.00000 -0.24245 0.353933 beta_ch_a -0.061319 -0.10753 0.12176 6.9522e-04 0.51820 0.45148 -0.24245 1.00000 0.191400 beta_ch_b -0.006432 -0.39537 0.34394 -0.13104 0.49489 -0.12425 0.35393 0.19140 1.000000 delta_a 0.065537 0.34199 -0.18694 0.08333 -0.60827 -0.25941 0.11161 -0.71834 -0.487098 delta_a asc_1 0.06554 beta_tt_a 0.34199 beta_tt_b -0.18694 beta_tc_a 0.08333 beta_tc_b -0.60827 beta_hw_a -0.25941 beta_hw_b 0.11161 beta_ch_a -0.71834 beta_ch_b -0.48710 delta_a 1.00000 Robust correlation matrix: asc_1 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 1.000000 0.08721 -0.1063 0.03311 -0.1933 -0.23192 0.20924 -0.2249 0.004854 beta_tt_a 0.087212 1.00000 -0.6483 0.81950 -0.7643 -0.34148 0.30092 -0.4691 -0.621356 beta_tt_b -0.106284 -0.64829 1.0000 -0.59699 0.7095 0.42768 -0.40923 0.2763 0.384094 beta_tc_a 0.033108 0.81950 -0.5970 1.00000 -0.5239 -0.23416 0.25809 -0.2173 -0.343366 beta_tc_b -0.193264 -0.76427 0.7095 -0.52391 1.0000 0.65484 -0.53820 0.8146 0.519757 beta_hw_a -0.231916 -0.34148 0.4277 -0.23416 0.6548 1.00000 -0.81872 0.7048 0.088210 beta_hw_b 0.209235 0.30092 -0.4092 0.25809 -0.5382 -0.81872 1.00000 -0.5573 0.085342 beta_ch_a -0.224868 -0.46907 0.2763 -0.21727 0.8146 0.70480 -0.55728 1.0000 0.351221 beta_ch_b 0.004854 -0.62136 0.3841 -0.34337 0.5198 0.08821 0.08534 0.3512 1.000000 delta_a 0.190947 0.62968 -0.3313 0.31730 -0.8638 -0.63166 0.49149 -0.9330 -0.540180 delta_a asc_1 0.1909 beta_tt_a 0.6297 beta_tt_b -0.3313 beta_tc_a 0.3173 beta_tc_b -0.8638 beta_hw_a -0.6317 beta_hw_b 0.4915 beta_ch_a -0.9330 beta_ch_b -0.5402 delta_a 1.0000 20 worst outliers in terms of lowest average per choice prediction: ID Avg prob per choice 22580 0.2768558 23205 0.2984733 14802 0.3143889 16489 0.3259532 16617 0.3263213 16178 0.3403213 15174 0.3422720 22961 0.3447656 18219 0.3490639 22278 0.3523953 20063 0.3576583 21922 0.3633953 20010 0.3660327 14074 0.3697172 13214 0.3728287 20100 0.3735637 76862 0.3760701 21623 0.3836318 13863 0.3953417 22820 0.4080098 Changes in parameter estimates from starting values: Initial Estimate Difference asc_1 0.00000 -0.04479 -0.044794 asc_2 0.00000 0.00000 0.000000 beta_tt_a 0.00000 -0.07353 -0.073532 beta_tt_b 0.00000 -0.09781 -0.097814 beta_tc_a 0.00000 -0.09568 -0.095684 beta_tc_b 0.00000 -0.53392 -0.533920 beta_hw_a -0.03960 -0.03964 -3.525e-05 beta_hw_b -0.04790 -0.04747 4.3295e-04 beta_ch_a -0.76240 -0.76404 -0.001637 beta_ch_b -2.17250 -2.16743 0.005067 delta_a 0.03290 0.03946 0.006557 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" panelData "TRUE" analyticGrad "TRUE" analyticGrad_manualSet "FALSE" Hessian routines attempted -------------- numerical jacobian of LL analytical gradient Scaling in estimation -------------- Value asc_1 0.04479433 beta_tt_a 0.07353256 beta_tt_b 0.09782218 beta_tc_a 0.09568384 beta_tc_b 0.53392640 beta_hw_a 0.03963604 beta_hw_b 0.04746751 beta_ch_a 0.76404806 beta_ch_b 2.16720142 delta_a 0.03945716 Scaling used in computing Hessian -------------- Value asc_1 0.04479436 beta_tt_a 0.07353246 beta_tt_b 0.09781421 beta_tc_a 0.09568404 beta_tc_b 0.53392048 beta_hw_a 0.03963525 beta_hw_b 0.04746705 beta_ch_a 0.76403745 beta_ch_b 2.16743259 delta_a 0.03945715 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) }