jeffgortmaker / pyblp

BLP Demand Estimation with Python
https://pyblp.readthedocs.io
MIT License
240 stars 83 forks source link

Naming Conventions Too Aggressive ? Add Warning? #62

Closed clukewatson closed 4 years ago

clukewatson commented 4 years ago

Howdy,

In hindsight the following issue was obvious, but I spent about three hours troubleshooting before I realized that pyblp.Problem was not picking up my demand-side IVs because I did not start at 0 (i.e., I started at demand_instruments1 rather than demand_instruments0). Part of the issue was that there were no errors and everything converged, my only clue was that Optimization Iterations = zero and non-linear parameters stayed at initial values regardless of starting value (so clearly something was wrong).

I think one of the following could help someone in the future:

  1. pyblp is less aggressive in names or indexes the variables internally (I suspect there is a similar issue with other special variables like supply_instruments, nodes)
  2. error/warning message if demand_instrument0 is not detected (no one is going to run a problem without excluded IVs)

Thanks again for all your efforts. Best, Luke

jeffgortmaker commented 4 years ago

Thanks for the feedback. This is a problem other people have had too.

You're right in (1) that there is a similar issue with other variables throughout the package. I agree with your (2) that a simple way to address this problem (for all variables) is just to have an informative warning message if you specify x1 without specifying x0 for any x. I'll put that together.