29  Endogeneity with censored variable

Published

April 20, 2024

29.1 Bunching for the outcome variable

Bunching is a mass point in the distribution of some variable — for example, the excess density of earned income at a kink in the tax schedule (Saez 2010). The idea is to compare the observed distribution with a counterfactual “manipulation-free” distribution and use the excess mass to estimate behavioral elasticities.

Bunching is closely related to regression discontinuity. RD assumes no manipulation at the threshold; bunching estimators relax that assumption and estimate the fraction of manipulators directly (Kleven 2016).

Caetano et al. (2020) extend bunching to the treatment variable, which is the focus of this chapter.

29.2 Bunching for the treatment variable

29.2.1 A test of endogeneity

Caetano (2015) showed that, if the distribution of \(T_i\) has bunching at \(T_i = \bar t\), it is possible to test the exogeneity of \(T_i\) . When one compares the outcome of observations at the bunching point and those around it, the treatment itself is very similar. Therefore, there cannot be more than a marginal difference in the outcome that is due to treatment variation, since the treatment hardly varies.

Caetano (2015)’s estimation can be done in a two step process:

  1. estimate \(E[Y_i | T_i = \bar T, X_i ]\) non-parametrically

  2. do a local linear regression \(E[Y_i | T_i = \bar T, X_i ] -Y_i\) onto \(T_i\) at \(\bar T\), using only observations such that \(T_i > \bar T\).

The approach is known as the Discontinuity Test.

29.2.2 Dummy test

Caetano and Maheshri (2018) proposed a simpler test, which is simply regressing \(Y_i\) on \(T_i\) , \(X_i\) and a dummy variable for \(T_i > \bar T\). The coefficient of the dummy variable is the test statistic. If the coefficient is significant, which is to say there is a discontinuity on outcome, then \(T_i\) is endogenous.

This is simpler, but with linear functional form assumption.

The logic of the endogeneity test is that around the bunching point, the treatment is very similar, so the outcome should be similar. If there is a discontinuity in the outcome, then it has to be one of two reasons. One is that treatment has discontinuous effect on outcome around the bunching point. Usually we can reasonably rule out that possibility. Second is that there is an unobserved variable that is causing both the treatment and the outcome. That unobserved variable has a discontinuous effect on the outcome. If that’s the case, then the treatment is endogenous.

29.2.3 Treatment effect estimation

Caetano et al (2020) proposed a method to estimate the treatment effect when there is bunching. It seems to me there is no reason that we cannot use it for the censoring situation. There are a lot of situations that we have censored treatment variable, when we study continuous treatment variable.

Suppose we have \[ Y = \beta T + Z \gamma + \delta \eta + \epsilon \tag{29.1}\]

where \(T\) is the treatment variable, \(\eta\) is the unobserved variable that is causing both the treatment and the outcome, \(Z\) is the control variables, and \(\epsilon\) is the error term. We only observe \(Y, T, Z\).

Suppose \(T^*\) is the latent variable that is censored at \(T^* = 0\). We observe \(T = max(T^*, 0)\). We assume that \(T^*\) is continuous over its support.

\[ T^* = Z \pi + \eta \tag{29.2}\]

From the two equations, we can derive:

\[ E[Y | T, Z] = (\beta + \delta)T + Z (\gamma - \pi \delta) + \delta E[T^* | T^* \le 0, Z] 1(T=0) \tag{29.3}\] or

\[ E[Y | T, Z] = \beta T + Z (\gamma - \pi \delta) + \delta (T + E[T^* | T^* \le 0, Z] 1(T=0)) \tag{29.4}\]

Therefore we can “correct” for endogeneity by simply including an additional term \(\delta (T + E[T^* | T^* \le 0, Z] 1(T=0))\) in the regression.

However, the prediction of \(\delta (T + E[T^* | T^* \le 0, Z] 1(T=0))\) is out of sample. We have to make some additional assumptions for the distribution of \(T^*\). For example, we can assume that \(T^*\) is normally distributed. Or, we can assume it is symmetric. Then we can use the right tail to estimate the left tail.

29.3 Simulation

Let’s do a simulation to see how it works.

We draw \(n = 1000\) observations. Two controls \((Z_1, Z_2)\) are joint normal with unit variances and correlation 0.5, and the unobserved confounder is \(\eta \sim N(1,1)\). The latent treatment is \(T^* = Z_1 + 2Z_2 + 1.5\eta\), censored at zero so that \(T = \max(T^*, 0)\), and the outcome is \(Y = 2T + 0.5Z_1 + 0.5Z_2 + 2\eta + N(0,1)\).

So the true treatment effect is \(\beta = 2\), and \(\eta\) enters both the treatment and the outcome with a positive sign — the endogeneity. Note \(Y\) depends on the observed censored \(T\), not on \(T^*\), which is what makes the mass point at \(T = 0\) informative: among those units the treatment is held fixed while \(\eta\) still varies.

Code
library(MASS)
library(ggplot2)
library(dplyr)
# set seed
set.seed(123)
# number of observations
n=1000
# generate Z and make it dataframe
Z=as.data.frame(mvrnorm(n=n, mu=c(0,0), Sigma=matrix(c(1,0.5,0.5,1),2,2)))
data <- Z
names(data) <- c("Z1", "Z2")
# generate eta
# eta is normally distributed
data$eta=rnorm(n, 1,1)
# generate T*
# T* is normally distributed
# Y depends on the OBSERVED (censored) treatment T, not the latent T_star --
# matching the structural equation Y = beta*T + Z*gamma + delta*eta + epsilon
# above. If Y depended on T_star directly, T=0 would not fully "block" the
# latent variable's effect on Y, and the treatment effect of T would not even
# be well defined.
data <- data %>%
  mutate(T_star=Z1 + 2*Z2 + 1.5*eta) %>%
  mutate(T=ifelse(T_star>0, T_star, 0)) %>%
  mutate(Y=2*T + 0.5*Z1 + 0.5*Z2 + 2*eta + rnorm(n, 0, 1))

# regress Y on T, Z1, Z2
lm1 <- lm(Y ~ T + Z1 + Z2, data=data)
summary(lm1)

Call:
lm(formula = Y ~ T + Z1 + Z2, data = data)

Residuals:
    Min      1Q  Median      3Q     Max 
-8.2706 -0.8700  0.1009  1.0955  4.0476 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) -0.42394    0.09588  -4.422 1.09e-05 ***
T            3.14972    0.03906  80.631  < 2e-16 ***
Z1          -0.29574    0.06667  -4.436 1.02e-05 ***
Z2          -1.14069    0.08060 -14.153  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.639 on 996 degrees of freedom
Multiple R-squared:  0.9343,    Adjusted R-squared:  0.9341 
F-statistic:  4719 on 3 and 996 DF,  p-value: < 2.2e-16

Without including \(eta\), the effect estimate is biased: OLS gives 3.150 against a true 2, an upward bias of 57%, and the standard error of 0.039 makes it look extremely precise. Let’s do a dummy test.

Code
lm2 <- lm(Y ~ T + Z1 + Z2 + I(T>0), data=data)
summary(lm2)

Call:
lm(formula = Y ~ T + Z1 + Z2 + I(T > 0), data = data)

Residuals:
    Min      1Q  Median      3Q     Max 
-8.0768 -0.8363  0.0406  0.9126  4.8213 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept)  -1.68077    0.11961 -14.052   <2e-16 ***
T             3.06030    0.03570  85.728   <2e-16 ***
Z1           -0.52092    0.06189  -8.416   <2e-16 ***
Z2           -1.48038    0.07601 -19.476   <2e-16 ***
I(T > 0)TRUE  2.10995    0.13884  15.197   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.477 on 995 degrees of freedom
Multiple R-squared:  0.9466,    Adjusted R-squared:  0.9464 
F-statistic:  4414 on 4 and 995 DF,  p-value: < 2.2e-16

It shows that the dummy variable is significant: the coefficient on \(1(T > 0)\) is 2.110 with a standard error of 0.139, \(t = 15.2\). It means that \(T\) is endogenous. The logic is the one set out above — at the bunching point the treatment barely varies, so a jump of this size in the outcome has to come from something else moving discontinuously, and \(\eta\) is the candidate.

29.3.1 Correcting for endogeneity

The correction term is \(E[T^* \mid T^* \le 0, Z]\), on the scale of the treatment \(T^*\) — so we need to model \(T^*\) given \(Z\), not \(Y\) given \(T\) and \(Z\). Let’s assume \(T^*\) is normally distributed given \(Z\): \(T^* \mid Z \sim N(Z\pi, \sigma^2)\). Since we observe \(T=T^*\) whenever \(T^*>0\) and \(T=0\) otherwise, this is exactly a (left-)censored (Tobit) regression of \(T\) on \(Z\), using all observations (not just the right tail): the censored observations still inform \(\pi\) and \(\sigma\) through the likelihood, they just don’t reveal \(T^*\)’s value directly. Given \(\hat\pi\) and \(\hat\sigma\), the standard truncated-normal mean formula gives us \(E[T^* \mid T^* \le 0, Z]\) directly, with no separate mirroring step needed:

\[ E[T^* \mid T^* \le 0, Z] = Z\hat\pi - \hat\sigma\,\frac{\phi(-Z\hat\pi/\hat\sigma)}{\Phi(-Z\hat\pi/\hat\sigma)} \tag{29.5}\]

Code
library(AER)

tob <- tobit(T ~ Z1 + Z2, left = 0, data = data)
lin_pred  <- coef(tob)["(Intercept)"] + coef(tob)["Z1"] * data$Z1 + coef(tob)["Z2"] * data$Z2
sigma_hat <- tob$scale
alpha     <- -lin_pred / sigma_hat
E_Tstar_below0 <- lin_pred - sigma_hat * dnorm(alpha) / pnorm(alpha)

# here I create an extra term for the correction:
# when T is 0, it is T (=0); otherwise it's the truncated-normal conditional
# mean of T* given T* <= 0 and Z, computed above.
data <- data %>%
  mutate(extra = if_else(T > 0, T, E_Tstar_below0))

lm4 <- lm(Y ~ T + Z1 + Z2 + extra, data=data)
summary(lm4)

Call:
lm(formula = Y ~ T + Z1 + Z2 + extra, data = data)

Residuals:
    Min      1Q  Median      3Q     Max 
-5.8902 -0.7686  0.0480  0.7935  5.4430 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  0.03693    0.07979   0.463    0.644    
T            1.98735    0.05917  33.585   <2e-16 ***
Z1          -0.82513    0.05838 -14.133   <2e-16 ***
Z2          -2.31062    0.08224 -28.097   <2e-16 ***
extra        1.36256    0.05873  23.200   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.321 on 995 degrees of freedom
Multiple R-squared:  0.9573,    Adjusted R-squared:  0.9572 
F-statistic:  5582 on 4 and 995 DF,  p-value: < 2.2e-16

Under the normality assumption, this recovers \(\beta\) (the true coefficient on \(T\) is 2) very closely — 1.987 with a standard error of 0.059, against OLS’s 3.150. The correction term itself enters with coefficient 1.363, which is the estimate of \(\delta\), the effect of \(\eta\) on \(Y\); the DGP sets that path at \(2/1.5 = 1.33\) once expressed per unit of \(T^*\). Note the control coefficients also move, from \(-0.296\) and \(-1.141\) to \(-0.825\) and \(-2.311\), because they were absorbing part of the confounding too — this is much better — much better than a naive symmetric-mirroring heuristic that estimates the right-tail conditional mean by an unweighted linear regression of \(T\) on \(Z\) restricted to a somewhat arbitrary right-tail cutoff: that heuristic’s accuracy turns out to be quite sensitive to the cutoff and sample used, because the true conditional mean of \(T^*\) given \(T^*\) beyond a cutoff is a nonlinear (inverse-Mills-ratio) function of \(Z\), not linear — so a plain linear regression on the selected right-tail subsample is itself misspecified. The parametric (Tobit) route sidesteps that by modeling the untruncated latent distribution directly and using the exact conditional-mean formula.

29.4 Conclusion

We are making assumptions for the distribution of the continuous treatment variable. Symmetry is the minimum assumption. We can make other parametric assumptions on the distribution of \(T^*\). This is a trade-off between making distribution assumptions and ignoring endogeneity. The good news is that we don’t need an instrument. We are using the censoring part of the treatment variable to deal with endogeneity.