Causality again

Experimental Data

  1. Field experiments: assign social program at random
    • JPAL runs hundreds of economic experiments all around the world
  2. Businesses experiment with design, marketing, customer interactions
    • Called “A/B tests” by tech companies
    • Microsoft, Amazon, Facebook, Google conduct over 10,000 each/year 1

Problems with nonexperimental data

Example: Job Training and Earnings

Experiments and treatment effects

Random coefficients

Relating to standard linear model

Estimation

Example: National Supported Work Program Experiment (Code 1)

#Load package containing data set 
#see sekhon.berkeley.edu/matching/ for info
#If not installed, run following command
install.packages("Matching",
 repos = "http://cran.us.r-project.org", 
 dependencies=TRUE)
library(Matching)
data(lalonde) #Load data set
library(sandwich) #Robust SEs
library(lmtest) #testing with robust SEs
    
# Show treatment unrelated to covariates
balancereg<-lm(formula = treat ~ age + educ + black + 
          hisp + married + nodegr + re74 + re75 +
          u74 + u75, data = lalonde)

Example: National Supported Work Program Experiment (Code 2)

#Build robust standard errors
balancereg.vcov<-vcovHC(balancereg, type="HC0")
#Conduct Wald test that coefs jointly 0
#using asymptotic Chi-squared distribution
jointtest<-waldtest(balancereg, 
  vcov=vcovHC(balancereg,type="HC0"), test = "Chisq")

Example: National Supported Work Program Experiment

jointtest<-waldtest(balancereg, 
  vcov=vcovHC(balancereg,type="HC0"), test = "Chisq")

Results

## Wald test
## 
## Model 1: treat ~ age + educ + black + hisp + married + nodegr + re74 + 
##     re75 + u74 + u75
## Model 2: treat ~ 1
##   Res.Df  Df  Chisq Pr(>Chisq)  
## 1    434                        
## 2    444 -10 21.564    0.01749 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Estimating treatment effect (Code)

#Run simple regression of outcome (Real earnings in 78) 
# on treatment in program
experiment<-lm(formula = re78 ~ treat, data = lalonde)
#Construct Robust SEs, test significance of causal effect
experiment.vcov<-vcovHC(experiment, type="HC0")
experiment.output<-coeftest(experiment,
      df=Inf,vcov. = experiment.vcov)
library(stargazer) #Display table of results
stargazer(experiment.output,type="html",style="all",
      header=FALSE,omit.table.layout="ldn",
      title="Job Training and 1978 Real Wages")

Estimating treatment effect

Job Training and 1978 Real Wages
treat 1,794.343***
(669.316)
t = 2.681
p = 0.008
Constant 4,554.802***
(339.438)
t = 13.419
p = 0.000

Interpretation

Observational Data and Natural Experiments

Control

Controlling for covariates

Example: Consumer Credit

Identifying Treatment Effects \(P(Y|do(x))\)

Estimating Treatment Effects

Omitted variables again

Covariates in binary treatment framework

Heterogeneous treatment effects

Lessons

Next class


  1. Kohavi and Thomke (2017), Harvard Business Review↩︎