PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT...

65
PUBL0050: Advanced Quantitative Methods Lecture 4: Selection on Observables (II) – Regression Jack Blumenau 1 / 59

Transcript of PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT...

Page 1: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

PUBL0050: Advanced Quantitative Methods

Lecture 4: Selection on Observables (II) – Regression

Jack Blumenau

1 / 59

Page 2: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Course outline

1. Potential Outcomes and Causal Inference2. Randomized Experiments3. Selection on Observables (I)4. Selection on Observables (II)5. Panel Data and Difference-in-Differences6. Synthetic Control7. Instrumental Variables (I)8. Instrumental Variables (II)9. Regression Discontinuity Designs10. Overview and Review

2 / 59

Page 3: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Motivation

ATT for Dehejia and Wahba

ATT

Fre

quen

cy

−5000 0 5000 10000 15000

05

1015

Experimental estimate

Is there a simpler way to condition on observable covariates?

3 / 59

Page 4: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Lecture Outline

Regression

Non-linearity and model dependence

The curse of dimensionality

Non-standard standard errors

Conclusion

4 / 59

Page 5: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression

Page 6: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression and “control”

The typical introduction to regression views motivates it as a way to‘control’ for potential confounding variables.

What do we do when we include a control in regression? We “hold itconstant” while evaluating the relationship between D and Y.

This is also what we do in both subclassification and (exact) matching:

1. fix the matches (subclasses)2. calculate the mean difference for each match (class)3. average the differences

Regression essentially does the same thing, but does it in a single step,and the type of averaging is different.

5 / 59

Page 7: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

What have we been estimating all this time?

Imagine that we want to estimate the causal effect of 𝐷𝑖 on 𝑌𝑖, and webelieve that 𝐷𝑖 is independent of the 𝑌0𝑖, 𝑌1𝑖 conditional on 𝑋𝑖.

Does the following regression equation identify the causal effect?

𝑌𝑖 = 𝛼 + 𝛽1𝐷𝑖 + 𝛽2𝑋𝑖 + 𝜖𝑖 (Long regression)

i.e. What does 𝛽1 estimate?

6 / 59

Page 8: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression anatomy

Textbook definition: 𝛽1 = 𝐶𝑜𝑣(𝑌𝑖, �̃�𝑖)𝑉 𝑎𝑟(�̃�𝑖)

where �̃�𝑖 are the residuals from a regression of 𝐷𝑖 on 𝑋𝑖.

This means that estimating 𝛽1 in the long regression is equivalent to:

1. Regressing 𝐷𝑖 on 𝑋𝑖:

𝐷𝑖 = 𝜋0 + 𝜋1𝑋𝑖 + 𝑒𝑖 (Treatment regression)

2. Calculating the residuals from that regression:

�̃�𝑖 = 𝐷𝑖 − ( ̂𝜋0 + ̂𝜋1𝑋𝑖) (Residual calculation)

3. Regressing 𝑌𝑖 on those residuals (and nothing else)

𝑌𝑖 = 𝛼∗ + 𝛽∗�̃�𝑖 + 𝜖∗ (Residual regression)

→ 𝛽∗ = 𝛽1 7 / 59

Page 9: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression anatomy

Let’s check using the ‘peace‘ data from last week:# Long regressioncoef(lm(dur ~ UN + ethfrac, data= peace))[2]

## UN## 35.24401

# Regression anatomytreatment_regression <- lm(UN ~ ethfrac, data = peace)treatment_residuals <- resid(treatment_regression)outcome_regression <- lm(dur ~ treatment_residuals, data = peace)

outcome_regression

## (Intercept) treatment_residuals## 60.16 35.24

8 / 59

Page 10: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression anatomy

What does this tell us?

1. 𝛽1 measures the relationship between 𝑌𝑖 and the part of 𝐷𝑖 that is“not explained” by 𝑋𝑖 (i.e. the residuals)

2. The part of 𝐷𝑖 that is “not explained” by 𝑋𝑖 is assumed to beindependent of potential outcomes i.e. it is “as good as” random (i.e.clear link to CIA)

Does this mean that 𝛽OLS is estimating 𝜏ATE?

9 / 59

Page 11: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression as a weighted matching estimator

Last week we showed that both (exact) matching and subclassificationcalculate the ATE by taking weighted averages of 𝛿𝑥:

𝜏ATE = ∑𝑥

𝑃 (𝑋𝑖 = 𝑥)𝛿𝑥

i.e. where the weights are the distribution of 𝑋𝑖 in the population (𝜏ATE)It can be shown (MHE, pp. 74 - 76) that the estimates for 𝛽 from an OLSregression of 𝑌 on 𝐷 and 𝑋 have a similar form:

𝛽OLS = ∑𝑥

𝑉 𝑎𝑟[𝐷𝑖 = 1|𝑋𝑖 = 𝑥]𝑃(𝑋𝑖 = 𝑥)∑𝑥 𝑉 𝑎𝑟[𝐷𝑖 = 1|𝑋𝑖 = 𝑥]𝑃(𝑋𝑖 = 𝑥)𝛿𝑥

10 / 59

Page 12: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression as a weighted matching estimator

𝛽OLS = ∑𝑥

𝑉 𝑎𝑟[𝐷𝑖 = 1|𝑋𝑖 = 𝑥]𝑃(𝑋𝑖 = 𝑥)∑𝑥 𝑉 𝑎𝑟[𝐷𝑖 = 1|𝑋𝑖 = 𝑥]𝑃(𝑋𝑖 = 𝑥)𝛿𝑥

Therefore, regression implicitly gives higher weight to:

• Subclasses with more units (higher marginal probability, i.e.𝑃(𝑋𝑖 = 𝑥))

• Subclasses where the variance of the treatment is higher (i.e.𝑉 𝑎𝑟[𝐷𝑖 = 1|𝑋𝑖 = 𝑥])

• For a binary treatment, this will be subclasses with more equalnumbers of treatment/control units

𝛽1 is an estimator “for the ATE but with supplemental conditionalvariance weighting.” (Morgan and Winship, Ch 6)

11 / 59

Page 13: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Example (by hand)

𝑤ATE ≡ 𝑃(𝑋𝑖 = 𝑥)

𝑤OLS ≡ 𝑉 𝑎𝑟[𝐷𝑖 = 1|𝑋𝑖 = 𝑥]𝑃(𝑋𝑖 = 𝑥)∑𝑥 𝑉 𝑎𝑟[𝐷𝑖 = 1|𝑋𝑖 = 𝑥]𝑃(𝑋𝑖 = 𝑥)

Region Dem N 𝑁1, 𝑁0 𝛿𝑥 𝛿𝑥 ⋅ 𝑤ATE 𝛿𝑥 ⋅ 𝑤OLS DifferenceE. Eur Non-dem 10 (5, 5) -29.2 -3.9 -5.9 -1.9E. Eur Dem 7 (2, 5) 66.8 6.3 7.6 1.3L. Am Non-dem 3 (2, 1) 144.0 5.8 7.7 1.9L. Am Dem 9 (2, 7) 5.1 0.6 0.6 0.0SS. Afr Non-dem 21 (4, 17) 27.9 7.9 7.2 -0.7SS. Afr Dem 14 (2, 12) 49.0 9.3 6.7 -2.5N Afr/ME Non-dem 8 (1, 7) 123.7 13.4 8.7 -4.7N Afr/ME Dem 2 (1, 1) 132.0 3.6 5.3 1.7

𝜏ATE = 42.97𝛽OLS = 38.07

So OLS gives something a bit like the ATE, but not quite…12 / 59

Page 14: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Example (using R)

We need to specify a saturated regression model – i.e. separateparameters for each value of the combination of the X variables – inorder to control comparably to subclassification and matching.saturated_model <- lm(dur ~ UN + region*dem, peace) # Fully interacted Xround(coef(saturated_model)[2],2) # Coefficient on the treatment

## UN## 38.07

Implication: regression will often give very similar estimates of the ATE tomatching and subclassification, particularly for saturated models.

13 / 59

Page 15: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression vs Matching vs Subclassification

In practice, regression will often give very similar estimates of the ATE tomatching and subclassification.

The UN peace example, controling for region and democratic history:

ATE ATT ATCSub-classification 42.97 39.54 44.15Matching (exact) 42.97 39.54 44.15

Regression 38.07

14 / 59

Page 16: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression as a weighted matching estimator

When will 𝛽OLS be an unbiased estimator for 𝜏ATE?

1. When 𝑃(𝐷𝑖 = 1|𝑋𝑖 = 𝑥) = 𝑃 (𝐷𝑖 = 1)∀𝑥• treatment probability is the same for everyone

• conditional variance is the same for everyone

• (e.g. in an experiment)

2. When 𝛿𝑥 = 𝜏ATE∀𝑥• treatment effects are the same for each subclass

• (e.g. effects are homogenous)

Question: Are either of these likely in an observational study?

15 / 59

Page 17: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Omitted Variable Bias

The more typical implict link made between regression and causality isvia the idea of omitted variables.

To fix ideas, consider two regression models:

Long: 𝑌𝑖 = 𝛼𝑙 + 𝛽𝑙1𝑋1𝑖 + 𝛽𝑙

2𝑋2𝑖 + 𝜖𝑙

Short: 𝑌𝑖 = 𝛼𝑠 + 𝛽𝑠1𝑋1𝑖 + 𝜖𝑠

Omitted variable bias: the bias that results from failing to control for 𝑋2𝑖in the short regression.

It will also be useful to define an ‘auxiliary’ regression:

Auxiliary: 𝑋2𝑖 = 𝜋0 + 𝜋1𝑋1𝑖 + 𝜂𝑖

16 / 59

Page 18: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Omitted Variable Bias

If we ignored 𝑋2𝑖 and just estimated the short regression, what does 𝛽𝑠1

identify? With a little bit of work (Mastering ’Metrics, p. 93) we can see:

𝛽𝑠1 = 𝐶𝑜𝑣(𝑌𝑖, 𝑋1𝑖)

𝑉 𝑎𝑟(𝑋1𝑖)= 𝛽𝑙

1 + 𝛽𝑙2𝜋1

• 𝛽𝑙1 → the coefficient of 𝑋1𝑖 on 𝑌𝑖 in the long regression

• 𝛽𝑙2 → the coefficient of 𝑋2𝑖 on 𝑌𝑖 in the long regression

• 𝜋1 → the coefficient of 𝑋1𝑖 on 𝑋2𝑖 in the ‘auxiliary’ regression

“Short equals long plus the effect of omitted times the regression ofomitted on included.” (MHE, p. 60)

OVB: 𝛽𝑠1 − 𝛽𝑙

1 = 𝛽𝑙2𝜋1

17 / 59

Page 19: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Omitted Variable Bias

Is it true that “short equals long plus the effect of omitted times theregression of omitted on included”?long <- lm(dur ~ UN + ethfrac,peace)short <- lm(dur ~ UN,peace)aux <- lm(ethfrac ~ UN,peace)

# Effect of UN in short regressioncoef(short)[2]

## UN## 40.80263

# Long + effect of omitted*reg of omitted on includedcoef(long)[2] + coef(long)[3]*coef(aux)[2]

## UN## 40.80263

Yes! 18 / 59

Page 20: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Omitted Variable Bias

OVB: 𝛽𝑠1 − 𝛽𝑙

1 = 𝛽𝑙2𝜋1

The difficulty is that we rarely know the values for either 𝛽𝑙2 or 𝜋1 and so

we can’t isolate 𝛽𝑙1.

This formula does however help to describe the possible direction of bias:

𝛽𝑙2 < 0 𝛽𝑙

2 > 0𝜋1 < 0 𝑂𝑉 𝐵 > 0 𝑂𝑉 𝐵 < 0𝜋1 > 0 𝑂𝑉 𝐵 < 0 𝑂𝑉 𝐵 > 0

Note also that:

• If 𝜋1 = 0, then 𝑂𝑉 𝐵 = 0, and• If 𝛽𝑙

2 = 0, then 𝑂𝑉 𝐵 = 019 / 59

Page 21: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Lessons from the OVB formula

Omitting 𝑋 causes bias in our estimate of ATE if and only if both thefollowing hold

• 𝑋 is related to the treatment, conditional on other covariates

• e.g. 𝜋1 ≠ 0• → no need to control for covariates when 𝐷 is randomly assigned

• 𝑋 is related to the outcome, conditional on other covariates

• e.g. 𝛽𝑙2 ≠ 0

• → no need to control for covariates that don’t effect 𝑌

20 / 59

Page 22: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Should I use regression?

Yes.• Computational simplicity• Many forms, very flexible• Easy inference• East to include continuoustreatments

No.• Not as clearly linked to the CIA• Do we care about theconditional-variance ATE?

My view: Yes, most of the time. The flexibility and simplicity of inferenceare very helpful, and it’s close enough to what we care about that it’s fineto use most of the time.

21 / 59

Page 23: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Non-linearity and model dependence

Page 24: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Non-Linearities

Let’s return to our civil war example. We would like to know the effect ofUN interventions on peace duration:

• 𝑌𝑖: Peace duration (dur, measured in months)• 𝐷𝑖: UN intervention (UN, binary)

A colleague suggests that an important confounder might be the durationof the prior cival war (𝑋𝑖: lwdurat), because:

• 𝜋1 ≠ 0 → the length of the previous war is probably associatedwith whether the UN intervenes

• 𝛽𝑙2 ≠ 0 → the length of the previous war is probably associated

with how long peace lasts

22 / 59

Page 25: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

War duration and peace duration

0 50 100 150

050

100

150

Duration of civil war (months)

Dur

atio

n of

pos

t−w

ar p

eace

• Is civil war duration linearly associated with peace duration?

We might not want to use a straight line to model this relationship!

23 / 59

Page 26: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Nonlinear functions of explanatory variables

One way of modelling non-linear relationships is to include polynomialfunctions of explanatory variables in our model:

Polynomial modelsPolynomial models take the following form:

Linear: 𝐸[𝑌𝑖] = 𝛼 + 𝛽1𝑋1Quadratic: 𝐸[𝑌𝑖] = 𝛼 + 𝛽1𝑋1 + 𝛽2𝑋2

1Cubic: 𝐸[𝑌𝑖] = 𝛼 + 𝛽1𝑋1 + 𝛽2𝑋2

1 + 𝛽3𝑋31

Where 𝑋21 is just 𝑋1 ∗ 𝑋1 and 𝑋3

1 is just 𝑋1 ∗ 𝑋1 ∗ 𝑋1, and so on.

In theory we can keep adding polynomial terms to make our model moreflexible, but it gets harder to interpret!

24 / 59

Page 27: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Polynomial functions of explanatory variables

Why do polynomial terms allow for non-linear relationships?

• When we include a quadratic term in the model, we are essentiallyincluding an interaction term

• i.e. the interaction between 𝑋1 and itself (because 𝑋1 ⋅ 𝑋1 = 𝑋21 )

• This implies that the association between 𝑋1 and 𝑌 will depend onthe specific value of 𝑋1 where we evaluate the relationship

• → the effect of a one-unit change in 𝑋1 will depend on the value of𝑋1 we are changing

25 / 59

Page 28: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Polynomial functions of explanatory variables

Interpreting polynomial coefficients is somewhat difficult:

• It is no longer possible to hold constant all other variables

• i.e. If you increase 𝑋1 by one-unit, then you also increase 𝑋21

• We can say something by looking at the sign of 𝛽𝑋2

• In general it is much more straightforward to produce fitted valueplots to describe the relationship between 𝑋 and 𝑌

26 / 59

Page 29: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Polynomial functions of explanatory variables

For the model 𝐸[𝑌 ] = 𝛼 + 𝛽1𝑋1 + 𝛽2𝑋21 :

β1> 0 & β2< 0

X

Yβ1< 0 & β2> 0

X

Y

β1> 0 & β2> 0

X

Y

β1< 0 & β2< 0

X

Y

27 / 59

Page 30: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Polynomial regression in R

In R we can include polynomial transformation of our 𝑋 variablesdirectly into the model formula:linear_model <- lm(dur ~ lwdurat, data = peace)quadratic_model <- lm(dur ~ lwdurat + I(lwdurat^2), data = peace)

28 / 59

Page 31: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Polynomial regression output

Table 1: Regression output

(1) (2)

𝑙𝑤𝑑𝑢𝑟𝑎𝑡 0.31∗∗∗ (0.08) 1.74∗∗∗ (0.34)𝑙𝑤𝑑𝑢𝑟𝑎𝑡2 −0.01∗∗∗ (0.002)Intercept 37.79∗∗∗ (6.45) 18.77∗∗ (7.29)

Observations 87 87R2 0.13 0.29

The coefficients are hard to interpret, but we can see that the quadraticterm is significant. What does this mean?

• The null hypothesis is that the relationship between X and Y is linear• We can reject this null: there is evidence of non-linearity here• We should also note that the model fit improves

29 / 59

Page 32: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Polynomial regression visualization

0 50 100 150

050

100

150

Duration of civil war (months)

Dur

atio

n of

pos

t−w

ar p

eace

linear fitted valuesquadratic fitted values

30 / 59

Page 33: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Why should we care about non-linearity?

There are 2 broad motivations for thinking about non-linearity:

1. Not all relationships are linear!

• Regression is a model that “by default” estimates linear relationships

• Sometimes, like here, linearity is not a good approximation of thetrue relationship.

• In these cases, we may want to specify a more flexible model tocapture more of reality

2. Mis-specifying a the non-linear relationship between a controlvariable and the outcome can lead to biased treatment effects

• This is known as model dependence

31 / 59

Page 34: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Non-linearity and model dependence

When using regression as a tool to estimate treatment effects, we alsotherefore need to decide how to control for confounders:linear_control <- lm(dur ~ UN + lwdurat, data = peace)quadratic_control <- lm(dur ~ UN + lwdurat + I(lwdurat^2), data = peace)

(1) (2)

UN 40.87∗∗∗ (10.90) 28.75∗∗∗ (10.86)𝑙𝑤𝑑𝑢𝑟𝑎𝑡 0.30∗∗∗ (0.08) 1.44∗∗∗ (0.34)𝑙𝑤𝑑𝑢𝑟𝑎𝑡2 −0.01∗∗∗ (0.002)Intercept 29.44∗∗∗ (6.41) 16.71∗∗ (7.08)

Observations 87 87R2 0.26 0.35

Note: The UN coefficient is very different in the two models!

32 / 59

Page 35: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression and model dependence

DefinitionModel dependence exists when our estimates depend on specificmodeling assumptions and where different specifications can yield verydifferent causal inferences.

What can we do about this problem?

33 / 59

Page 36: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Break

Go to this link: https://bit.ly/2tYzal7

34 / 59

Page 37: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression, matching and model dependence

DefinitionModel dependence exists when our estimates depend on specificmodeling assumptions and where different specifications can yield verydifferent causal inferences.

What can we do about this problem?

One common approach is to use matching as a preprocessing tool toreduce model dependence (see Ho et. al, 2007).

35 / 59

Page 38: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression, matching and model dependence

−5 0 5 10 15 20 25 30

−60

−40

−20

020

40

X

Y

C

C

C

C

C

C

C

C

CC

C

C

C

C

CC

C

C

C

C

C

C

CC

CC

C

CC

C

T

TT

T

T

TT

T

TT

TT

TT

T

T

TT

T T

Linear control for X: ̂𝛽1 > 0

36 / 59

Page 39: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression, matching and model dependence

−5 0 5 10 15 20 25 30

−60

−40

−20

020

40

X

Y

C

C

C

C

C

C

C

C

CC

C

C

C

C

CC

C

C

C

C

C

C

CC

CC

C

CC

C

T

TT

T

T

TT

T

TT

TT

TT

T

T

TT

T T

Linear control for X: ̂𝛽1 > 0

37 / 59

Page 40: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression, matching and model dependence

−5 0 5 10 15 20 25 30

−60

−40

−20

020

40

X

Y

C

C

C

C

C

C

C

C

CC

C

C

C

C

CC

C

C

C

C

C

C

CC

CC

C

CC

C

T

TT

T

T

TT

T

TT

TT

TT

T

T

TT

T T

Quadratic control for X: ̂𝛽1 < 0

38 / 59

Page 41: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression, matching and model dependence

−5 0 5 10 15 20 25 30

−60

−40

−20

020

40

X

Y

C

C

C

C

C

C

C

C

CC

C

C

C

C

CC

C

C

C

C

C

C

CC

CC

C

CC

CC

CCC

CC

C

CC

CCC

C

C

C

CC

CC

C

T

TT

T

T

TT

T

TT

TT

TT

T

T

TT

T T

Linear control for X: ̂𝛽1 > 0

39 / 59

Page 42: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression, matching and model dependence

−5 0 5 10 15 20 25 30

−60

−40

−20

020

40

X

Y

C

C

C

C

C

C

C

C

CC

C

C

C

C

CC

C

C

C

C

C

C

CC

CC

C

CC

CCCC

CCCCCCCC

CCCCCC

CC

CCCC

CCCCCC

CC

C

C

CCCC

CCCCC

CC

TTT

TTTTT

TTT

TTT

TTTTT

TT

TTTT

TTTT

TTT

T

TT

TTTT

TTT TT

Post-matching: ̂𝛽linear ≈ ̂𝛽quadratic ≈ 0

40 / 59

Page 43: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Regression, matching and model dependence

Using matching to ensure that common support holds can make ourparametric estimates less model dependent.

Implications:

• Estimates will be less sensitive to small changes in modellingchoices that are particularly common in regression analysis.

• We will frequently lack common support for both treatment andcontrol observations, which we then discard. This has consequencesfor the interpretation of estimated treatment effects

41 / 59

Page 44: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

The curse of dimensionality

Page 45: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Curse of dimensionality

Matching, regression, and subclassification all rely on the idea that wecan make comparisons between treatment and control units that haveotherwise similar 𝑋 variables.

Often, we will be able to come up with many possible confounding factorsthat we might want to condition upon.

Problem:The curse of dimensionalityThe total quantity of data ‘near’ any given point in 𝑋 falls off veryquickly when the dimensionality of 𝑋 increases.

42 / 59

Page 46: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Curse of dimensionality

X1

X2

0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

0.0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1.0

43 / 59

Page 47: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Curse of dimensionality

• The average distance from the nearest observation increases veryfast as we add explanatory variables (the data becomes ‘sparse’ in𝑋)

• Increasing the sample size helps, but not much!

• To maintain the same average distance to nearest observations whengoing from 1 to 2 explanatory variables often requires manythousands more observations

• Implication: Adding more covariates may make matches more“appropriate”, but also makes them far harder to make

44 / 59

Page 48: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Implications of the curse of dimensionality

• Matching:

• Exact matching: very few exact matches• Nearest neighbour: if more distant matches are less reliable, adding

𝑋s might make ‘nearest’ matches poor control choices

• Subclassification:

• Many empty cells, or cells with only treatment/control units

• Regression:

• With saturated regression: many NA coefficients• With restricted regression: more reliance on model, and thusincreased threat of model dependent results

Generally: As dimensionality increases, restricting to observations withreasonable matches will lead to unrepresentative estimates

45 / 59

Page 49: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Non-standard standard errors

Page 50: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Errors and residuals, re-cap

Recall the linear regression model:

𝑌𝑖 = 𝛼 + 𝛽1𝑋1 + 𝛽2𝑋2 + 𝜖𝑖

Most regression software by default makes two restrictive assumptionsabout the error term, 𝜖:

1. Errors are independent and identically distributed for eachobservation (iid)

2. Errors have equal variance for all values of 𝑋 (homoskedasticity)

When either of these things fail, our standard errors will be wrong. Herewe will discuss two potential failures of these assumptions.

46 / 59

Page 51: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Homoskedasticity vs Heteroskedasticity

Homoskedastic errors−

20

24

Binary treatment

Out

com

e

Control Treatment

Mean ± 1sd

Continuous treatment

Treatment

Out

com

e

47 / 59

Page 52: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Homoskedasticity vs Heteroskedasticity

Heteroskedastic errors−

20

24

68

10

Binary treatment

Out

com

e

Control Treatment

Mean ± 1sd

Continuous treatment

Treatment

Out

com

e

47 / 59

Page 53: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Implications of heteroskedasticity

The good news:

• Whether the errors are homoskedastic or heteroskedastic ̂𝛽 is bothunbiased and consistent

The bad news:

• If the homoskedasticity assumption is violated:

• 𝑡-statistics do not have a standard normal distribution• Conventional standard errors will be too small• Hypothesis tests will reject the null hypothesis too often• Confidence intervals will be too narrow

Heteroskedasticity can lead to standard errors that are too small or toolarge. But we generally care less about overestimating the standard error.

48 / 59

Page 54: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Heteroskedasticity in t-tests and regression

Let’s consider an experiment where the variance of the outcome isdifferent in the treatment and control groups:

Control Treatment

−10

−5

05

10

x

y

49 / 59

Page 55: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Heteroskedasticity in t-tests and regression

By default, the lm() function in R assumes homoskedastic errors:summary(lm(y ~ x))

## Estimate Std. Error t value Pr(>|t|)## (Intercept) 0.2072 0.1913 1.083 0.279## x 0.4462 0.2209 2.021 0.044 *

But the t.test() function does not:t.test(y[x==1], y[x==0])

## data: y[x == 1] and y[x == 0]## t = 1.2896, df = 104.82, p-value = 0.2## alternative hypothesis: true difference in means is not equal to 0

Note: The regression provides the wrong conclusion!

50 / 59

Page 56: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Heteroskedasticity correction in R

library(sandwich)library(lmtest)

# Use coeftest from the lmtest package to tell R to calculate# heteroskedasticity-robust SEs (”HC3”)ols_mod <- lm(y ~ x)coeftest(ols_mod, vcov = vcovHC(ols_mod, type = ”HC3”))

#### t test of coefficients:#### Estimate Std. Error t value Pr(>|t|)## (Intercept) 0.20715 0.34281 0.6043 0.5460## x 0.44624 0.34774 1.2833 0.2001

Note: The standard error, t-statistic and p-value are now correct.

51 / 59

Page 57: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Clustered data

Another way in which normal standard errors can be wrong is when wehave clustered data.

Examples:

• An experiment where villages are selected into treatment/controlbut the outcome is measured at the household level

• An observational study where we care about the effects of class sizebut we measure individual student outcomes

Key: Always ask yourself: at what level was the treatment assigned?

52 / 59

Page 58: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Clustering example

The STAR ExperimentThe STAR project was a randomized experiment designed to test thecausal effects of class sizes on learning. Classes in Tennessee schoolswere randomly assigned either to regular sized classes (22-25 students,the control group) or to smaller classes (15-17 students, the treatmentgroup). We observe student outcomes at the individual level.

• Y (Dependent variable): grade of student

• Student grade on a standardised math test (0 to 100)

• X (Independent variable): size of class

• TRUE = student in small class, FALSE = student in regular sized class

53 / 59

Page 59: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Why does clustering affect standard errors?

Imagine we have a regression like:

𝑌𝑖(𝑔) = 𝛼 + 𝛽1𝑋𝑔 + 𝜖𝑖(𝑔)

where 𝑋𝑔 is a covariate that only varies at the group level.

• Normal standard errors are calculated assuming that errors (𝜖) areuncorrelated across units

• This is clearly not the case here!

• Students in the same class will have similar grades because of otherfactors (teacher quality; time of day; etc)

• When errors are correlated within groups, the normal standarderrors will be too small

• This will be particularly bad when the number of groups is small54 / 59

Page 60: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

STAR example in R

Let’s run the STAR regression:linear_model <- lm(grade ~ small_class, data= star)summary(linear_model)

## Estimate Std. Error t value Pr(>|t|)## (Intercept) 45.8255 0.1869 245.20 < 2e-16 ***## small_class 2.2234 0.3410 6.52 7.61e-11 ***

But note that although the errors are almost surely correlated withinclass, we are treating them as independent.

55 / 59

Page 61: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Cluster-robust standard errors

One solution to this problem is to use cluster-robust standard errors.summary(linear_model)

## Estimate Std. Error t value Pr(>|t|)## (Intercept) 45.8255 0.1869 245.20 < 2e-16 ***## small_class 2.2234 0.3410 6.52 7.61e-11 ***

coeftest(linear_model, vcov = vcovCL, cluster = ~ schidkn)

## Estimate Std. Error t value Pr(>|t|)## (Intercept) 45.82546 0.71275 64.2941 < 2.2e-16 ***## small_class 2.22339 0.61750 3.6006 0.0003201 ***

Note: Here, the cluster-robust errors are twice as large as the regularstandard errors, but the conclusion remains the same. This will notalways be the case…

56 / 59

Page 62: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Cluster-robust standard errors

Normal standard errors are partly determined by the sample size, 𝑁 .

• As 𝑁 ↑, 𝑆𝐸(𝛽) ↓

Clustered standard errors are more sensitive to the number of clusters,𝐺, than they are to 𝑁 .

• As 𝐺 ↑, 𝑆𝐸(𝛽)Clustered ↓

Implications:

1. Collecting more data only helps if you are collecting from newgroups

2. 𝑆𝐸(𝛽)Clustered will perform poorly when the number of clusters issmall (< 30).

57 / 59

Page 63: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Conclusion

Page 64: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Conclusion

My own view: Differences between estimation strategies are far lessimportant than the data you have collected.

Simply, for selection on observables to hold, you need good observables!

Don’t spend ages trying to persuade me that your new matchingestimator is really great. Instead:

• Think hard about which variables are crucial to condition upon• Collect better data relevant to these confounders• Find settings where there are very good covariates (RDD is going tobe an example of this)

• Find setting where confounders are less important (experiments,natural experiments, diff-in-diff etc)

58 / 59

Page 65: PUBL0050:AdvancedQuantitativeMethods Lecture4 ... · Motivation ATT for Dehejia and Wahba ATT Frequency-5000 0 5000 10000 15000 0 5 10 15 Experimental estimate Isthereasimplerwaytoconditiononobservablecovariates?

Next week

Panel data and difference-in-differences

59 / 59