Inconsistencies w/ R in Discrete Choice and Random Utility PyMC example?

Greetings,

I am relatively new to pymc and am trying to construct a discrete choice model of heating system adoption. I found this very relevant and helpful example. However, I am noting that the parameter estimates in this example end up being quite different than those for the R mlogit package (here), which uses the same dataset.

In particular, the Basic Model in the pymc example generates positive coefficient values for the installed cost predictor (beta_ic=0.002, sd=0 in pymc vs. beta_ic=-0.00623187, stderror=0.00035277 in the analogous R result.) Even when improving the model specification in the Improved Model, the positive coefficient value remains at close to zero (while continuing to be negative in the mlogit example). The author attempts to justify the result but I suspect something is wrong with the model specification because it doesn’t make sense for increased equipment installed cost to translate into increased probability of adoption (and again, this is not the case in the mlogit model).

Can anyone help diagnose what is going on, and whether this model might be misspecified? (I noted another thread in which model misspecification resulted in similar issues, but I have been unable to translate the fix to this case.)

Thank you in advance!

Welcome! Perhaps @Nathaniel_Forde can help as he developed this notebook.

Hi JTL,

Thanks for the feedback on the notebook. You’re correct that the result is in the early models are in contradiction with theory. The idea of the notebook was to show escalating complexity in the models and arrive at the point in the final model where you use priors to constrain the estimates more effectively.

I suspect you could probably improve things for the earlier models by either having tighter priors on the beta parameter. I was using Normal(0, 1) is this context and that seems quite wide in retrospect.

Or additionally you could have a negatively constrained prior as i show in the last model where you force the price effect to be realised as a negative value.

Finally for a Bayesian model I generally would focus more on the range of the posterior than a comparison of point estimates with R. The estimation methods are different and the Bayesian fit is incorporating uncertainty i’ve embedded the prior setting. So for resolving i’d play around with how you set the priors on the price coefficient and perform a kind of sensitivity analysis.