Instrumental Variables in R exercises (Part-2)

May 22, 2017

(This article was first published on R-exercises, and kindly contributed to R-bloggers)

This is the second part of the series on Instrumental Variables. For other parts of the series follow the tag instrumental variables.

In this exercise set we will build on the example from part-1.
We will now consider an over-identified case i.e. we have multiple IVs for an endogenous variable. We will also look at tests for endogeneity and over-identifying restrictions.

Answers to the exercises are available here.

Exercise 1
Load the AER package (package description: here). Next, load PSID1976 dataset provided with the AER package. This has data regarding labor force participation of married women.
Define a new data-frame that has data for all married women that were employed. This data-frame will be used for the following exercises.

Exercise 2
We will use a more elaborate model as compared to the previous set.
Regress log(wage) on education, experience and experience^2.

Exercise 3
Previously, we identified feducation and meducation as possible IVs for education.
Regress education on experience, experience^2, feducation and meducation. Comment on your results.

Exercise 4
Test the hypothesis that feducation and meducation are jointly equal to zero.

Exercise 5
Use 2SLS to estimate the IV based return to education.

Exercise 6
Use the ivreg command to get the same results as in Exercise-5. Note that standard errors would be different.

Exercise 7
There is a short form for the ivreg command which saves time when we are dealing with numerous variables.
Try the short format and check that you get the same results as in Exercise-6.

Exercise 8
Regress log(wage) on education, experience, experience^2 and residuals from the model estimated in Exercise-3.
Use your result to test for the endogeneity of education.

Exercise 9
Regress the residuals from exercise-7 on experience, experience^2, feducation and meducation.
Use your result to test for over-identifying restrictions.

Exercise 10
The two tests we did in exercises 8 and 9 can be conveniently obtained using the summary command with diagnostics turned on. Verify that you get the same test results with the summary command.

To leave a comment for the author, please follow the link and comment on their blog: R-exercises. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)