Last Update: March 22, 2022
My online video tutorials are hosted at YouTube channel.
For learning this concept, you can view my online video tutorial: Instrumental Variables: Two Stage Least Squares in R.
Video Code
1. Package
library(AER)
2. Data
data(HousePrices)
3. Model
mlr1 <- lm(formula = price ~ lotsize + bedrooms, data = HousePrices)
4. Instrumental Variables
Two Stage Least Squares
mlr2 <- ivreg(formula = price ~ lotsize + bedrooms | bedrooms + driveway +
garage, data = HousePrices)
smlr1 <- summary(object = mlr1)
smlr2 <- summary(object = mlr2, test = "F")
smlr1$coefficients
smlr2$coefficients
smlr1$fstatistic
smlr2$waldtest
Courses
My online courses are hosted at Teachable website.
For more details on this concept, you can view my Linear Regression in R Course.