Site icon R-bloggers

Instrumental Variables in R exercises (Part-2)

[This article was first published on R-exercises, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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.

Related exercise sets:

  1. Instrumental Variables in R exercises (Part-1)
  2. Bioinformatics Tutorial with Exercises in R (part 1)
  3. Let’s get started with dplyr
  4. Explore all our (>1000) R exercises
  5. Find an R course using our R Course Finder directory

To leave a comment for the author, please follow the link and comment on their blog: R-exercises.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.