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)")