I am modelling commuting mode choice with working from home and latent variables and followed the Hybrid with OL example. I have 775 response and I have observation for each day of the week.The model yield results NA values and the Model diagnosis : Function evaluation limit
Warnings below
Code: Select all
WARNING: Your model did not converge properly, and some of your parameter values are tending to +/- infinity. This could point to an identification issue. If you want to retain these parameters in the model, you may wish to set their value(s) in apollo_beta to the
estimated value(s), include the parameter name(s) in apollo_fixed, and re-estimate the model.
WARNING: Function evaluation limit exceeded. No covariance matrix will be computed. You may wish to use the current estimates as starting values for a new estimation with a higher limit for functional evaluations.
Calculating log-likelihood at equal shares (LL(0)) for applicable models...
Calculating log-likelihood at observed shares from estimation data (LL(c)) for applicable models...
Calculating LL of each model component...
Calculating other model fit measuresModel output
Code: Select all
Model run by galchalabi using Apollo 0.3.3 on R 4.4.1 for Windows.
Please acknowledge the use of Apollo by citing Hess & Palma (2019)
DOI 10.1016/j.jocm.2019.100170
www.ApolloChoiceModelling.com
Model name : Hybrid_with_OL
Model description : Hybrid choice model for mode choice, using ordered measurement model for indicators
Model run at : 2024-09-07 12:10:53.130165
Estimation method : bgw
Model diagnosis : Function evaluation limit
Number of individuals : 775
Number of rows in database : 5425
Number of modelled outcomes : 16275
indic_WFH : 5425
indic_PT : 5425
choice : 5425
Number of cores used : 4
Number of inter-individual draws : 100 (halton)
LL(start) : -23679.43
LL (whole model) at equal shares, LL(0) : -26193.6
LL (whole model) at observed shares, LL(C) : -23496.55
LL(final, whole model) : -9506.9
Rho-squared vs equal shares : 0.6371
Adj.Rho-squared vs equal shares : 0.6356
Rho-squared vs observed shares : 0.5954
Adj.Rho-squared vs observed shares : 0.5942
AIC : 19091.8
BIC : 19349.15
LL(0,indic_WFH) : -8731.2
LL(final,indic_WFH) : -1246.67
LL(0,indic_PT) : -8731.2
LL(final,indic_PT) : -1143.95
LL(0,choice) : -8731.2
LL(final,choice) : -6960.49
Estimated parameters : 39
Time taken (hh:mm:ss) : 00:05:18.72
pre-estimation : 00:00:43.66
estimation : 00:04:33.45
post-estimation : 00:00:1.61
Iterations : 40 (Function evaluation limit)
Unconstrained optimisation.
Estimates:
Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0)
ASC_Vehicle 1.707021 NA NA NA NA
ASC_PublicTransport -0.970834 NA NA NA NA
ASC_ActiveTransport -1.151623 NA NA NA NA
ASC_WorkingFromHome 1.012865 NA NA NA NA
ASC_NoWork 1.373569 NA NA NA NA
beta_Time_Car -0.040052 NA NA NA NA
beta_Cost_Car 0.036422 NA NA NA NA
beta_Time_PT -0.004526 NA NA NA NA
beta_Cost_PT 0.721712 NA NA NA NA
lambda_WFH -0.060012 NA NA NA NA
lambda_PT -0.045332 NA NA NA NA
theta_Age_WFH -0.004578 NA NA NA NA
theta_Male_WFH -0.166477 NA NA NA NA
theta_LowIncome_WFH -0.040313 NA NA NA NA
theta_MediumIncome_WFH 0.036023 NA NA NA NA
theta_HighIncome_WFH 0.096654 NA NA NA NA
theta_IndWhite_WFH -0.400721 NA NA NA NA
theta_IndBlue_WFH -0.455759 NA NA NA NA
theta_OcuWhite_WFH 0.049924 NA NA NA NA
theta_OcuBlue_WFH 0.077259 NA NA NA NA
theta_Age_PT -0.001315 NA NA NA NA
theta_Male_PT -0.048081 NA NA NA NA
theta_LowIncome_PT 0.379665 NA NA NA NA
theta_MediumIncome_PT 0.578647 NA NA NA NA
theta_HighIncome_PT 0.334107 NA NA NA NA
theta_IndWhite_PT 0.270871 NA NA NA NA
theta_IndBlue_PT 0.095815 NA NA NA NA
theta_OcuWhite_PT 0.466909 NA NA NA NA
theta_OcuBlue_PT 0.621822 NA NA NA NA
zeta_WFH 80.590470 NA NA NA NA
zeta_PT 141.469921 NA NA NA NA
tau_WFH_1 -153.569804 NA NA NA NA
tau_WFH_2 -100.391974 NA NA NA NA
tau_WFH_3 -42.740433 NA NA NA NA
tau_WFH_4 21.967523 NA NA NA NA
tau_PT_1 -55.212948 NA NA NA NA
tau_PT_2 62.513828 NA NA NA NA
tau_PT_3 201.820357 NA NA NA NA
tau_PT_4 338.679566 NA NA NA NA
Overview of choices for OL model component indic_WFH:
1 2 3 4 5
Times chosen 378.00 567.00 1169.00 1470.0 1841.00
Percentage chosen overall 6.97 10.45 21.55 27.1 33.94
Overview of choices for OL model component indic_PT:
1 2 3 4 5
Times chosen 476.00 1022.00 2016.00 1561.00 350.00
Percentage chosen overall 8.77 18.84 37.16 28.77 6.45
Overview of choices for MNL model component choice:
Vehicle PublicTransport ActiveTransport WorkingFromHome NoWork
Times available 5425.00 5425.00 5425.00 5425.00 5425.00
Times chosen 1628.00 833.00 119.00 1181.00 1664.00
Percentage chosen overall 30.01 15.35 2.19 21.77 30.67
Percentage chosen when available 30.01 15.35 2.19 21.77 30.67
20 worst outliers in terms of lowest average per choice prediction:
ID Avg prob per choice
R_12uxDRARG3yoY5h 3.951196e-05
R_2B9UFKiqemRFvmz 8.203888e-04
R_3rN8Zthz59ACYBd 5.417788e-03
R_21vMQusFUyMW8bL 2.093446e-02
R_2BbQQs4tQoIeH6m 2.358597e-02
R_UGzOgH86MvbUOI1 2.589048e-02
R_1NEdoQUiSeHuQmf 2.628768e-02
R_2EHwnKYyHvkuKel 2.828073e-02
R_3MEG2abA3AZRHVY 2.840509e-02
R_247qz2w0qSuWmL0 3.003574e-02
R_C9bQaJMj5H9zz4B 3.299912e-02
R_2EbK1sO5VGmPDXG 3.318150e-02
R_31H2jIz9nhUlU10 3.371296e-02
R_1KvC6SXSIECzICk 3.437248e-02
R_Ckvv7Uro21C8RWx 3.443865e-02
R_d75mJeDXltCIMYp 3.637728e-02
R_2qDkrIxM8z0njmm 3.698073e-02
R_1BRsBnYYUBJLLzf 4.068484e-02
R_32ISsCLDBeW3Xf0 4.120479e-02
R_232g4OKvbTv2U0E 4.145712e-02
Changes in parameter estimates from starting values:
Initial Estimate Difference
ASC_Vehicle 0.000 1.707021 1.707021
ASC_PublicTransport 0.000 -0.970834 -0.970834
ASC_ActiveTransport 0.000 -1.151623 -1.151623
ASC_WorkingFromHome 0.000 1.012865 1.012865
ASC_NoWork 0.000 1.373569 1.373569
beta_Time_Car 0.000 -0.040052 -0.040052
beta_Cost_Car 0.000 0.036422 0.036422
beta_Time_PT 0.000 -0.004526 -0.004526
beta_Cost_PT 0.000 0.721712 0.721712
lambda_WFH 1.000 -0.060012 -1.060012
lambda_PT 1.000 -0.045332 -1.045332
theta_Age_WFH 0.000 -0.004578 -0.004578
theta_Male_WFH 0.000 -0.166477 -0.166477
theta_LowIncome_WFH 0.000 -0.040313 -0.040313
theta_MediumIncome_WFH 0.000 0.036023 0.036023
theta_HighIncome_WFH 0.000 0.096654 0.096654
theta_IndWhite_WFH 0.000 -0.400721 -0.400721
theta_IndBlue_WFH 0.000 -0.455759 -0.455759
theta_OcuWhite_WFH 0.000 0.049924 0.049924
theta_OcuBlue_WFH 0.000 0.077259 0.077259
theta_Age_PT 0.000 -0.001315 -0.001315
theta_Male_PT 0.000 -0.048081 -0.048081
theta_LowIncome_PT 0.000 0.379665 0.379665
theta_MediumIncome_PT 0.000 0.578647 0.578647
theta_HighIncome_PT 0.000 0.334107 0.334107
theta_IndWhite_PT 0.000 0.270871 0.270871
theta_IndBlue_PT 0.000 0.095815 0.095815
theta_OcuWhite_PT 0.000 0.466909 0.466909
theta_OcuBlue_PT 0.000 0.621822 0.621822
zeta_WFH 1.000 80.590470 79.590470
zeta_PT 1.000 141.469921 140.469921
tau_WFH_1 -2.000 -153.569804 -151.569804
tau_WFH_2 -1.000 -100.391974 -99.391974
tau_WFH_3 1.000 -42.740433 -43.740433
tau_WFH_4 2.000 21.967523 19.967523
tau_PT_1 -2.000 -55.212948 -53.212948
tau_PT_2 -1.000 62.513828 63.513828
tau_PT_3 1.000 201.820357 200.820357
tau_PT_4 2.000 338.679566 336.679566
Settings and functions used in model definition:
apollo_control
--------------
Value
modelName "Hybrid_with_OL"
modelDescr "Hybrid choice model for mode choice, using ordered measurement model for indicators"
indivID "id"
nCores "4"
outputDirectory "C:/statistics/MDCEV/HCM/"
mixing "TRUE"
debug "FALSE"
workInLogs "FALSE"
seed "13"
HB "FALSE"
noValidation "FALSE"
noDiagnostics "FALSE"
calculateLLC "TRUE"
analyticHessian "FALSE"
panelData "TRUE"
analyticGrad "TRUE"
analyticGrad_manualSet "FALSE"
overridePanel "FALSE"
preventOverridePanel "FALSE"
noModification "FALSE"
Hessian routines attempted
--------------------------
none
apollo_randCoeff
------------------
function(apollo_beta, apollo_inputs){
randcoeff = list()
randcoeff[["LV_WFH"]] = theta_Age_WFH * Age + theta_Male_WFH * Male + theta_LowIncome_WFH * Low_Income +
theta_MediumIncome_WFH * Medium_Income + theta_HighIncome_WFH * High_Income +
theta_IndWhite_WFH * Ind_White_Collar + theta_IndBlue_WFH * Ind_Blue_Collar +
theta_OcuWhite_WFH * Ocu_White_Collar + theta_OcuBlue_WFH * Ocu_Blue_Collar + eta_WFH # LV_WFH
randcoeff[["LV_PT"]] = theta_Age_PT * Age + theta_Male_PT * Male + theta_LowIncome_PT * Low_Income +
theta_MediumIncome_PT * Medium_Income + theta_HighIncome_PT * High_Income +
theta_IndWhite_PT * Ind_White_Collar + theta_IndBlue_PT * Ind_Blue_Collar +
theta_OcuWhite_PT * Ocu_White_Collar + theta_OcuBlue_PT * Ocu_Blue_Collar + eta_PT # LV_PT
return(randcoeff)
}
<bytecode: 0x000001de136219c8>
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()
### Likelihood of indicators
ol_settings1 = list(outcomeOrdered = BenSaveCommuteCosts, V = zeta_WFH * LV_WFH, tau = list(tau_WFH_1, tau_WFH_2, tau_WFH_3, tau_WFH_4), componentName = "indic_WFH") # ζ_WFH, τ_WFH
ol_settings2 = list(outcomeOrdered = PtComfort, V = zeta_PT * LV_PT, tau = list(tau_PT_1, tau_PT_2, tau_PT_3, tau_PT_4), componentName = "indic_PT") # ζ_PT, τ_PT
P[["indic_WFH"]] = apollo_ol(ol_settings1, functionality)
P[["indic_PT"]] = apollo_ol(ol_settings2, functionality)
### Likelihood of choices
### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
V = list()
V[["Vehicle"]] = ASC_Vehicle + beta_Time_Car * Time_Car + beta_Cost_Car * Cost_Car + lambda_WFH * LV_WFH + lambda_PT * LV_PT # ASC_Vehicle, β_Time_Car, β_Cost_Car, λ_WFH, λ_PT
V[["PublicTransport"]] = ASC_PublicTransport + beta_Time_PT * Time_PT + beta_Cost_PT * Cost_PT + lambda_WFH * LV_WFH + lambda_PT * LV_PT # ASC_PublicTransport, β_Time_PT, β_Cost_PT, λ_WFH, λ_PT
V[["ActiveTransport"]] = ASC_ActiveTransport + beta_Time_PT * Time_PT + lambda_WFH * LV_WFH + lambda_PT * LV_PT # ASC_ActiveTransport, β_Time_PT, λ_WFH, λ_PT
V[["WorkingFromHome"]] = ASC_WorkingFromHome + lambda_WFH * LV_WFH # ASC_WorkingFromHome, λ_WFH
V[["NoWork"]] = ASC_NoWork # ASC_NoWork
### Define settings for MNL model component
mnl_settings = list(
alternatives = c(Vehicle=1, PublicTransport=2, ActiveTransport=3, WorkingFromHome=4, NoWork=5),
avail = list(Vehicle=1, PublicTransport=1, ActiveTransport=1, WorkingFromHome=1, NoWork=1),
choiceVar = Mode_1,
utilities = V,
componentName = "choice"
)
### Compute probabilities for MNL model component
P[["choice"]] = apollo_mnl(mnl_settings, functionality)
### Likelihood of the whole model
P = apollo_combineModels(P, apollo_inputs, functionality)
### Take product across observation for same individual
P = apollo_panelProd(P, apollo_inputs, functionality)
### Average across inter-individual draws
P = apollo_avgInterDraws(P, apollo_inputs, functionality)
### Prepare and return outputs of function
P = apollo_prepareProb(P, apollo_inputs, functionality)
return(P)
}