jeffgortmaker / pyblp

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

Question: model with no endogenous variables? #130

Closed ny1526 closed 1 year ago

ny1526 commented 1 year ago

Hi Jeff,

I am trying to estimate a demand model with random coefficients where I am treating all the characteristics are exogenous. (This may be a naive assumption, but for now, I am going with it.) I don't have prices in my model, so I rename one of the variables arbitrarily to prices so that I can set up the product_data and run the solver.

However, I seem to be running into the same problem as #122, where I am stuck at the same initial sigma values, perhaps because the model is underidentified. Maybe I am understanding this incorrectly, but I think the model should be just-identified since I do not have any endogenous variables. But I am wondering if it runs into this issue because it thinks that my prices variable is endogenous and requires an instrument.

Am I understanding this correctly? Is there a way to set up the problem so that all variables are considered exogenous?

Thanks again for your help.

jeffgortmaker commented 1 year ago

Right, so it's dropping the variable that you call prices from the set of instruments because it thinks it's endogenous. An easier thing to do is set add_exogenous=False and manually specific your full set of instruments in demand_instruments0, demand_instruments1, etc. Usually PyBLP just adds the non-price variables in X1 to this list.

ny1526 commented 1 year ago

Ah got it, I didn't see the add_exogenous option. That works now, thank you!