Created
November 30, 2022 19:23
-
-
Save diamonaj/fe37cc133354bb4f9b83d2d1c60547dd to your computer and use it in GitHub Desktop.
Pre-Class Work coding solution for session 18 (quantile effects)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Code Cell 1 of 4 | |
| # Show median treatment effect estimation here | |
| #install.packages("quantreg") | |
| library(quantreg) | |
| library(Matching) | |
| data(lalonde) | |
| rqfit_r50 <- rq(re78 ~ treat, tau = 0.5, data = lalonde) | |
| summary(rqfit_r50) | |
| ## Code Cell 2 of 4 | |
| # Show 90% quantile estimation here | |
| rqfit_r90 <- rq(re78 ~ treat, tau = 0.9, data = lalonde) | |
| summary(rqfit_r90) | |
| ## Code Cell 3 of 4 | |
| Y <- lalonde$re78 | |
| Tr <- lalonde$treat | |
| X <- cbind(lalonde$age,lalonde$educ,lalonde$black,lalonde$hisp,lalonde$married,lalonde$nodegr,lalonde$re74,lalonde$re75,lalonde$u74,lalonde$u75) | |
| mout <- Match(Y,Tr,X) | |
| ## Code cell 4 of 4 | |
| lalonde2 <- rbind(lalonde[mout$index.treated,], lalonde[mout$index.control,]) | |
| rqfit_match <- rq(re78 ~ treat, tau = c(0.5,0.9), data = lalonde2) | |
| summary(rqfit_match) | |
| ###### | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment