pymc-devs / pymc-examples

Examples of PyMC models, including a library of Jupyter notebooks.
https://www.pymc.io/projects/examples/en/latest/
MIT License
280 stars 243 forks source link

Slight Mis-Interpretation of Discrete Choice Theory #617

Open mitch-at-orika opened 10 months ago

mitch-at-orika commented 10 months ago

Discrete Choice and Random Utility Models: Notebook url:

Issue description

Firstly thanks for putting this up, its a great effort @NathanielF something that took me ages to figure out and your example will be a great resource for others going forward. I wanted to highlight that In discrete choice models you dont typically set the whole utility to zero for one alternative you just set one of the contants to zero. Refer to page 21 of Train Book Ch2 for why - its about the identification issue.

I do acknowledge though that it isnt uncommon to do it like you have done as per this example: BAPs multinomial_ppcs that does set everything to zero for one class.

My issue would be that the model is then ignoring the Xs in that alternative. Also, as you articulate well, discrete choice is being nuanced in how the utility is expressed per alternative and saying one must be zero is killing that.

Expected output / Proposed solution

I think the first example (no contants) should just have utility like other alternatives.

then second one where you bring in contants you can either just u4 = 0 + beta_ic wide_heating_df["ic.gr"] + beta_oc wide_heating_df["oc.gr"] or concatenate a zero onto the alpha if you want to do it as a tensor op like Alex did in the Multinomial PPCs example.

Thanks again.

NathanielF commented 9 months ago

Thanks for thinking through this @mitch-at-orika !

Would you like to open a PR demonstrating the difference in the specification? In particular it'd be interesting to discuss differences in interpretation where relevant.

mitch-at-orika commented 9 months ago

I dont do this PR on public repos often... I hope I got it all right but there is a PR up there now. Results of the option with no constant are better and results of the example with constants are ~ same maybe a bit worse. The marginal rate of substitition calc goes from 2 -> 0.7. Tried comparing with the mlogit example I think they are both a bit different. Hope this helps, let me know if I need to do the PR differently better. Also keen to talk through implications. Cheers, Mitch