Heterogeneous Effects

Identifying Outcome Distributions

Effects on Distributions vs Distributions of Effects

What can we learn about effect distributions?

Outcome Distribution Estimation

Quantile Regression

Properties of quantile regression estimator

Challenges with quantile regression

Conditional Density Estimation

Weighting method: Trees

Bagging

Random Forests

Adjustment

Data Example: Wage Distribution Response to Labor Supply Shock

#Libraries
library(quantreg) #quantile regression
library(quantregForest) #quantile random forests
library(ggplot2) #Plots
library(drf) #distributional random forests
library(Counterfactual) #Conditional counterfactual distributions
library(npcausal) #Conditional counterfactual distributions 
library(haven) #Stata data
library(dplyr) #data manipulation

#Data set from Breza Kaur and Shamdasani (2021)
#In my case this is saved at
rationing<-read_dta("Data/rationing_worker.dta")
spilloversample<-dplyr::filter(rationing,surv_el==1 & sample_spillover==1 & e_manwage==1)
spilloversample$treated<-factor(spilloversample$treat)
spilloversample$peakseason<-factor(spilloversample$peak, labels=c("Off-Peak Season","Peak Season"))

ggplot(spilloversample)+facet_wrap(~peakseason)+
  stat_ecdf(aes(x=dailywagetot,color=treated))+
  ggtitle("Wage Distribution Response to Labor Supply Shock: Conditional CDF",
          subtitle="Breza, Kaur, and Shamdasani (2021)")+
  ylab("Fraction of Workers")+xlab("Daily Total Wage (Rupees)")

- Alternately represent by conditional kernel density, which applies smoothing and may improve interpretation, but is less precisely estimated due to slower rate of density vs CDF estimation

ggplot(spilloversample)+facet_wrap(~peakseason)+
  geom_density(aes(x=dailywagetot,fill=treated,color=treated),alpha=0.5)+
  ggtitle("Wage Distribution Response to Labor Supply Shock: Conditional Kernel Density",
          subtitle="Breza, Kaur, and Shamdasani (2021)")+
  ylab("Probability Density of Workers")+xlab("Daily Total Wage (Rupees)")

Example Continued: Quantile Treatment Effects from Distribution Regression

peaksample<-filter(spilloversample,peak==1) #Just on-peak observations


taus <- c(1:99)/100 #Estimate at 99 quantiles evenly spaced

#Control for baseline characteristics as in Table 3 Col. 3 of Breza et al (2021)
logitres<-counterfactual(ldailywagetot_w~bl_ldwagetot+bl_dwagetot_miss+bl_e_manwage+bl_e_manwage_miss+factor(round_id),
          data=peaksample, group=treat, treatment=TRUE, quantiles=taus, 
          decomposition=TRUE, method="logit", seed=123,
          printdeco=FALSE, 
          sepcore = TRUE,ncore=2)
#Steal plotting code from software vignette

first <- sum(as.double(taus <= .10))
last <- sum(as.double(taus <= .90))
rang <- c(first:last)
duqf_SE<- (logitres$resSE)[,1]
l.duqf_SE<- (logitres$resSE)[,3] 
u.duqf_SE<- (logitres$resSE)[,4] 
duqf_CE<- (logitres$resCE)[,1] 
l.duqf_CE<- (logitres$resCE)[,3] 
u.duqf_CE<- (logitres$resCE)[,4] 
duqf_TE<- (logitres$resTE)[,1] 
l.duqf_TE<- (logitres$resTE)[,3] 
u.duqf_TE<- (logitres$resTE)[,4]
range_x <- min(c(min(l.duqf_SE[rang]),min(l.duqf_CE[rang]),min(l.duqf_TE[rang])))
range_y <- max(c(max(u.duqf_SE[rang]),max(u.duqf_CE[rang]),max(u.duqf_TE[rang])))
par(mfrow=c(1,3))
plot(c(0,1), range(c(range_x, range_y)), xlim = c(0,1), type = "n",
  xlab = expression(tau), ylab = "Difference in Wages", cex.lab=0.75, main = "Total")
  polygon(c(taus[rang],rev(taus[rang])),c(u.duqf_TE[rang], rev(l.duqf_TE[rang])), density = -100, border = F,
          col="grey70",lty=1,lwd=1)
lines(taus[rang],duqf_TE[rang])
abline(h=0,lty=2)  

plot(c(0,1), range(c(range_x, range_y)), xlim = c(0,1), type = "n",
  xlab = expression(tau), ylab = "Difference in Wages", cex.lab=0.75, main = "Structure")
  polygon(c(taus[rang],rev(taus[rang])),c(u.duqf_SE[rang], rev(l.duqf_SE[rang])), density = -100, border = F,
          col="grey70",lty=1,lwd=1)
lines(taus[rang],duqf_SE[rang])
abline(h=0,lty=2)

plot(c(0,1), range(c(range_x, range_y)), xlim = c(0,1), type = "n",
  xlab = expression(tau), ylab = "Difference in Wages", cex.lab=0.75, main = "Composition")
  polygon(c(taus[rang],rev(taus[rang])),c(u.duqf_CE[rang], rev(l.duqf_CE[rang])), density = -100, border = F,
          col="grey70",lty=1,lwd=1)
lines(taus[rang],duqf_CE[rang])
abline(h=0,lty=2)

Example: Series Conditional Density

xyz<-data.frame(peaksample$ldailywagetot_w,peaksample$treat,peaksample$bl_ldwagetot,peaksample$bl_dwagetot_miss,peaksample$bl_e_manwage,peaksample$bl_e_manwage_miss,peaksample$round_id)
xyzclean<-as.matrix(filter(xyz,is.na(xyz)==FALSE))
xcovariates<-xyzclean[,3:7]
treat<-xyzclean[,2]
lwage<-xyzclean[,1]
set.seed(1234)
cdensity(lwage,treat,xcovariates,kmax=10,progress_updates=FALSE)

##     parameter       est         se      ci.ll     ci.ul
## 1 L2 distance 0.1637761 0.05830747 0.04949343 0.2780587

Conditional Average Treatment Effects

Estimating CATE

Conclusion

References

Athey, Susan, and Guido W Imbens. 2006. “Identification and Inference in Nonlinear Difference-in-Differences Models.” Econometrica 74 (2): 431–97.
Belloni, Alexandre, Victor Chernozhukov, Iván Fernández-Val, and Christian Hansen. 2017. “Program Evaluation and Causal Inference with High-Dimensional Data.” Econometrica 85 (1): 233–98.
Breza, Emily, Supreet Kaur, and Yogita Shamdasani. 2021. “Labor Rationing.” American Economic Review 111 (10): 3184–224. https://doi.org/10.1257/aer.20201385.
Chernozhukov, Victor, Iván Fernández-Val, and Alfred Galichon. 2010. “Quantile and Probability Curves Without Crossing.” Econometrica 78 (3): 1093–1125.
Chernozhukov, Victor, Iván Fernández-Val, and Blaise Melly. 2013. “Inference on Counterfactual Distributions.” Econometrica 81 (6): 2205–68.
Ćevid, Domagoj, Loris Michel, Jeffrey Näf, Nicolai Meinshausen, and Peter Bühlmann. 2021. “Distributional Random Forests: Heterogeneity Adjustment and Multivariate Distributional Regression.” http://arxiv.org/abs/2005.14458.
DiNardo, John, Nicole M Fortin, and Thomas Lemieux. 1996. “Labor Market Institutions and the Distribution of Wages, 1973-1992: A Semiparametric Approach.” Econometrica 64 (5): 1001–44.
Firpo, Sergio, and Geert Ridder. 2019. “Partial Identification of the Treatment Effect Distribution and Its Functionals.” Journal of Econometrics 213 (1): 210–34.
French, Eric, and Christopher Taber. 2011. “Chapter 6 - Identification of Models of the Labor Market.” In, edited by Orley Ashenfelter and David Card, 4:537–617. Handbook of Labor Economics. Elsevier. https://doi.org/https://doi.org/10.1016/S0169-7218(11)00412-6.
Ghosal, Subhashis, and Aad Van der Vaart. 2017. Fundamentals of Nonparametric Bayesian Inference. Vol. 44. Cambridge University Press.
Hall, Peter, Jeff Racine, and Qi Li. 2004. “Cross-Validation and the Estimation of Conditional Probability Densities.” Journal of the American Statistical Association 99 (468): 1015–26.
Kennedy, Edward H., Sivaraman Balakrishnan, and Larry Wasserman. 2021. “Semiparametric Counterfactual Density Estimation.” http://arxiv.org/abs/2102.12034.
Koenker, Roger. 2005. Quantile Regression. Econometric Society Monographs. Cambridge University Press. https://doi.org/10.1017/CBO9780511754098.
———. 2017. “Quantile Regression: 40 Years On.” Annual Review of Economics 9 (1): 155–76. https://doi.org/10.1146/annurev-economics-063016-103651.
Künzel, Sören R, Jasjeet S Sekhon, Peter J Bickel, and Bin Yu. 2019. “Metalearners for Estimating Heterogeneous Treatment Effects Using Machine Learning.” Proceedings of the National Academy of Sciences 116 (10): 4156–65.
Meinshausen, Nicolai, and Greg Ridgeway. 2006. “Quantile Regression Forests.” Journal of Machine Learning Research 7 (6).
Nelsen, Roger B. 2007. An Introduction to Copulas. Springer Science & Business Media.
Pearl, Judea, Madelyn Glymour, and Nicholas P Jewell. 2016. Causal Inference in Statistics: A Primer. John Wiley & Sons.
Singh, Rahul, Liyuan Xu, and Arthur Gretton. 2021. “Generalized Kernel Ridge Regression for Nonparametric Structural Functions and Semiparametric Treatment Effects.” http://arxiv.org/abs/2010.04855.
Wager, Stefan, and Susan Athey. 2018. “Estimation and Inference of Heterogeneous Treatment Effects Using Random Forests.” Journal of the American Statistical Association 113 (523): 1228–42.