28: MTC Motorized - Shared Ride - Non-Motorized Nested Mode Choice

28: MTC Motorized - Shared Ride - Non-Motorized Nested Mode Choice

import larch.numba as lx
m = lx.example(17)

Model 28’s nesting structure groups motorized, shared ride, and non-motorized. (pp. 185)

shared = m.graph.new_node(parameter='mu_shared', children=[2,3], name='Shared')
motorized = m.graph.new_node(parameter='mu_moto', children=[1,shared,4], name='Motorized')
nonmotorized= m.graph.new_node(parameter='mu_nonmoto', children=[5,6], name='Nonmotorized')
m.ordering = (
    ("CostbyInc","costbyincome",),
    ("TravelTime",".*time.*",".*dist.*", ),
    ("Household","hhinc.*","vehbywrk.*",),
    ("Zonal","wkcbd.*","wkempden.*",),
    ("ASCs","ASC.*",),
)
m.maximize_loglike()
/home/runner/work/larch/larch/larch/larch/model/optimization.py:308: UserWarning: slsqp may not play nicely with unbounded parameters
if you get poor results, consider setting global bounds with model.set_cap()
  warnings.warn( # infinite bounds # )
keyvalue
x
0
ASC_Bike -1.194
ASC_SR2 -1.239
ASC_SR3+ -1.621
ASC_Transit -0.400
ASC_Walk 0.347
costbyincome -0.033
hhinc#4 -0.004
hhinc#5 -0.010
hhinc#6 -0.006
motorized_ovtbydist -0.115
motorized_time -0.015
mu_moto 0.728
mu_nonmoto 0.766
mu_shared 0.241
nonmotorized_time -0.046
vehbywrk_Bike -0.735
vehbywrk_SR -0.225
vehbywrk_Transit -0.703
vehbywrk_Walk -0.765
wkcbd_Bike 0.415
wkcbd_SR2 0.293
wkcbd_SR3+ 0.472
wkcbd_Transit 0.931
wkcbd_Walk 0.123
wkempden_Bike 0.002
wkempden_SR2 0.001
wkempden_SR3+ 0.001
wkempden_Transit 0.002
wkempden_Walk 0.002
loglike-3439.942474802497
d_loglike
0
ASC_Bike -3.319e-04
ASC_SR2 -5.264e-03
ASC_SR3+ 4.693e-03
ASC_Transit 2.006e-03
ASC_Walk 2.282e-04
costbyincome -4.195e-03
hhinc#4 1.104e-01
hhinc#5 -5.899e-02
hhinc#6 1.494e-02
motorized_ovtbydist -5.212e-04
motorized_time 9.061e-02
mu_moto 2.575e-03
mu_nonmoto -6.917e-05
mu_shared 4.423e-03
nonmotorized_time 2.376e-03
vehbywrk_Bike -5.383e-04
vehbywrk_SR -6.810e-05
vehbywrk_Transit 1.868e-03
vehbywrk_Walk 3.076e-04
wkcbd_Bike 2.307e-04
wkcbd_SR2 -4.211e-03
wkcbd_SR3+ 4.410e-03
wkcbd_Transit 1.509e-03
wkcbd_Walk 1.168e-04
wkempden_Bike 4.517e-02
wkempden_SR2 -3.306e-01
wkempden_SR3+ -1.490e-01
wkempden_Transit 2.873e-01
wkempden_Walk 2.161e-02
nit87
nfev222
njev87
status0
message'Optimization terminated successfully'
successTrue
elapsed_time0:00:01.947781
method'slsqp'
n_cases5029
iteration_number0
logloss0.68402117216196
__verbose_repr__True
m.calculate_parameter_covariance()
m.parameter_summary()
    Value Std Err t Stat Signif Null Value
Category Parameter          
CostbyInc costbyincome -0.0334  0.0101 -3.32 *** 0.00
TravelTime motorized_time -0.0149  0.00383 -3.88 *** 0.00
nonmotorized_time -0.0460  0.00540 -8.53 *** 0.00
motorized_ovtbydist -0.115  0.0212 -5.41 *** 0.00
Household hhinc#4 -0.00402  0.00162 -2.48 * 0.00
hhinc#5 -0.0102  0.00465 -2.20 * 0.00
hhinc#6 -0.00638  0.00302 -2.11 * 0.00
vehbywrk_Bike -0.735  0.228 -3.22 ** 0.00
vehbywrk_SR -0.225  0.0652 -3.45 *** 0.00
vehbywrk_Transit -0.703  0.150 -4.69 *** 0.00
vehbywrk_Walk -0.765  0.163 -4.69 *** 0.00
Zonal wkcbd_Bike  0.415  0.327  1.27 0.00
wkcbd_SR2  0.293  0.0989  2.96 ** 0.00
wkcbd_SR3+  0.472  0.136  3.48 *** 0.00
wkcbd_Transit  0.931  0.224  4.15 *** 0.00
wkcbd_Walk  0.123  0.236  0.52 0.00
wkempden_Bike  0.00175  0.00109  1.61 0.00
wkempden_SR2  0.00137  0.000362  3.79 *** 0.00
wkempden_SR3+  0.00140  0.000369  3.80 *** 0.00
wkempden_Transit  0.00231  0.000522  4.42 *** 0.00
wkempden_Walk  0.00224  0.000768  2.91 ** 0.00
ASCs ASC_Bike -1.19  0.416 -2.87 ** 0.00
ASC_SR2 -1.24  0.241 -5.15 *** 0.00
ASC_SR3+ -1.62  0.355 -4.57 *** 0.00
ASC_Transit -0.400  0.221 -1.82 0.00
ASC_Walk  0.347  0.358  0.97 0.00
Other mu_moto  0.728  0.136 -2.00 * 1.00
mu_nonmoto  0.766  0.178 -1.31 1.00
mu_shared  0.241  0.105 -7.23 *** 1.00