Instrumental Variables in Python: Estimating Price Elasticity
ฝัง
- เผยแพร่เมื่อ 19 มิ.ย. 2022
- I use data from the Kathryn Graddy's analysis of the Fulton Fish Market to estimate the price elasticity of demand in that market. I explain, on a theoretical/graphical level, why standard OLS regression cannot satisfactorily estimate the demand curve or its elasticity, and explain why IV can help us to estimate the elasticity of demand.
Kathryn Graddy's paper: www.aeaweb.org/articles?id=10...
My Jupyter Notebook and the data are posted on GitHub: github.com/MattBirch42/Fulton... - ยานยนต์และพาหนะ
Thanks for sharing! The code and explanations helped me a lot!
Glad to hear it! Good luck!
Great explanation!
Glad it helped! Good luck!!
Awesome explanation and code!
Please do more problems with Python code!
Cheers
I'm glad you liked it. You'll probably want to look elsewhere for Python videos, though. Mine will be coming very slowly :)
@MattBirch, love the video. Very useful for what I'm working on. Question though: since the R-Squared for the IV model is so low, are we still able to trust the slope coefficient and thus PED?
How high of an R-Squared do we need to have a reliable demand curve?
Totally depends on context.
The r squared can be higher than my little toy example of course!
You can construct proper confidence intervals in an IV framework,and from there it just depends on what you need. But if you have confounding or endogeneity in your model and do normal OLS, it won't usually matter what the r squared or CI is. Because the model will give you an estimate that is biased, even with large data sets.
you mentioned the linear regression model is bad - accounting for just 8% of the observations, but the IV model's R2 is far worse....
It is, and it always will be. Casual inference models with observational data will always be weaker than pure prediction models.
The reason is that the CI goal, getting an unbiased estimate of a beta, is not the same as the prediction goal of minimizing so.e sort of error term.
In this case, we used the weather to predict price variation,and the used predicted prices in the quantity equation. The weather only predicts some of price and introduces more noise, and so the main equation has more noise in it.
On top of that, error terms in CI models can also be greatly complicated depending on the endogenous behavior on the error term, so this video really only scratches the surface.
But it is a start. Cheers!
Hey I had a question (slightly detailed). Was wondering if I could send you an email or something?
Can't promise much, but feel free to ask.
Connect and message me on LinkedIn
www.linkedin.com/in/matt-birch-phd-332a0b186