Problem set 8
Due by 11:59 PM on Monday, November 14, 2022
This assignment is a review of all the causal inference methods we’ve learned this semester: RCTs, matching and inverse probability weighting, diff-in-diff, RDD, and IVs. Refer to your past assignments and all the examples for guidance:
- RCTs: Example + Problem Set 3
- Matching and inverse probability weighting: Example + Problem Set 3
- Diff-in-diff: Example + Problem Sets 4 and 5
- RDD: Example + Problem Set 6
- Instrumental variables: Example + Problem Set 7
You’ll be doing all your R work in R Markdown. You can download a zipped file of a pre-made project here:
And as always, if you’re struggling, please talk to me. Work with classmates too (especially for this assignment!). Don’t suffer in silence!
Instructions
If you’re using R on your own computer, download this file, unzip it, and double click on the file named
problem-set-8.Rproj
:problem-set-8.zip
You’ll need to make sure you have these packages installed on your computer:
tidyverse
,broom
,estimatr
,modelsummary
,MatchIt
,rdrobust
,rddensity
, andhaven
. If you try to load one of those packages withlibrary(tidyverse)
orlibrary(MatchIt)
, etc., and R gives an error that the package is missing, use the “Packages” panel in RStudio to install it.(Alternatively, you can open the project named “Problem Set 8” on RStudio.cloud and complete the assignment in your browser without needing to install anything. This link should take you to the project—if it doesn’t, log in and look for the project named “Problem Set 8.”)
Rename the R Markdown file named
your-name_problem-set-8.Rmd
to something that matches your name and open it in RStudio.Complete the tasks given in the R Markdown file. You can remove any of the question text if you want.
You can definitely copy, paste, and adapt from other code in the document or the different example pages—don’t try to write everything from scratch!.
You’ll need to insert your own code chunks. Rather than typing them by hand (that’s tedious!), use the “Insert” button at the top of the editing window, or press ⌥ + ⌘ + I on macOS, or ctrl + alt + I on Windows.
Remember that you can run an entire chunk by clicking on the green play arrow in the top right corner of the chunk. You can also run lines of code line-by-line if you place your cursor on some R code and press ⌘ + enter (for macOS users) or ctrl + enter (for Windows users).
Make sure you run each chunk sequentially. If you run a chunk in the middle of the document without running previous ones, it might not work, since previous chunks might do things that later chunks depend on.
When you’re all done, click on the “Knit” button at the top of the editing window and create a Word or PDF version (if you’ve installed tinytex) of your document. Upload that file to iCollege. Do not upload a knitted HTML file (they don’t on iCollege).