If, however, your models violate the IIA, you need to resort to more advanced models. In this recipe, we will see one of them—a slightly more complicated Nested Logit model. The model groups similar alternatives into nests (hence the name). Given the limited space here, we will not discuss the intricacies of the model, but I highly recommend Kenneth Train's book that I referred to earlier in this chapter.
To execute this recipe, you need a working Python Biogeme package installed on your machine. No other prerequisites are required.
The skeleton of the model code remains the same; here, we will only show the changes (the Nested/dcm_nested.py
file):
# add the coefficients to be estimated C_price = Beta('C_price',0,-10,10,0,'C price' ) V_price = Beta('V_price',0,-10,10,0,'V price' ) Y_price = Beta('Y_price',0,-10,10,0,'Y price' ) Z_price = Beta('Z_price',0,-10,10,0,'Z price' ) ASC = Beta('ASC',0,-10,10,1,'ASC' ) B_refund...