2: MTC MNL Mode Choice, Motorized
2: MTC MNL Mode Choice, Motorized¶
Model 2 posits that the effect of income relative to drive alone is the same for both shared ride modes and transit but is different for the other modes. This is represented in the model by constraining the income coefficients in both shared ride modes and the transit mode to be equal. pp. 108
To accomplish this, we give the income parameters for all three alternatives the same name.
import larch.numba as lx
from larch import P, X, PX
d = lx.examples.MTC(format='dataset')
m = lx.Model(d)
m.title = "MTC Example 2, Motorized"
m.utility_co[2] = P("ASC_SR2") + P("hhinc#Moto") * X("hhinc") # ←
m.utility_co[3] = P("ASC_SR3P") + P("hhinc#Moto") * X("hhinc") # ← Note same P("hhinc#Moto")
m.utility_co[4] = P("ASC_TRAN") + P("hhinc#Moto") * X("hhinc") # ←
m.utility_co[5] = P("ASC_BIKE") + P("hhinc#5") * X("hhinc")
m.utility_co[6] = P("ASC_WALK") + P("hhinc#6") * X("hhinc")
m.utility_ca = PX("tottime") + PX("totcost")
m.availability_var = 'avail'
m.choice_ca_var = 'chose'
m.ordering = (
("LOS", "totcost", "tottime", ),
("Income", "hhinc.*", ),
("ASCs", "ASC.*", ),
)
m.maximize_loglike()
key | value | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
loglike | -3628.2854897475563 | ||||||||||||||||||||||
x |
| ||||||||||||||||||||||
tolerance | 2.334716996422727e-06 | ||||||||||||||||||||||
steps | array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]) | ||||||||||||||||||||||
message | 'Optimization terminated successfully.' | ||||||||||||||||||||||
elapsed_time | 0:00:00.232468 | ||||||||||||||||||||||
method | 'bhhh' | ||||||||||||||||||||||
n_cases | 5029 | ||||||||||||||||||||||
iteration_number | 0 | ||||||||||||||||||||||
logloss | 0.7214725571182256 | ||||||||||||||||||||||
__verbose_repr__ | True |
m.calculate_parameter_covariance()
m.parameter_summary()
Value | Std Err | t Stat | Signif | Null Value | ||
---|---|---|---|---|---|---|
Category | Parameter | |||||
LOS | totcost | -0.00490 | 0.000238 | -20.57 | *** | 0.00 |
tottime | -0.0514 | 0.00310 | -16.61 | *** | 0.00 | |
Income | hhinc#5 | -0.0125 | 0.00532 | -2.35 | * | 0.00 |
hhinc#6 | -0.00925 | 0.00302 | -3.07 | ** | 0.00 | |
hhinc#Moto | -0.00287 | 0.00122 | -2.35 | * | 0.00 | |
ASCs | ASC_BIKE | -2.39 | 0.304 | -7.85 | *** | 0.00 |
ASC_SR2 | -2.14 | 0.0884 | -24.18 | *** | 0.00 | |
ASC_SR3P | -3.53 | 0.115 | -30.64 | *** | 0.00 | |
ASC_TRAN | -0.799 | 0.112 | -7.11 | *** | 0.00 | |
ASC_WALK | -0.230 | 0.193 | -1.19 | 0.00 |