29  Endogeneity with censored variable

Published

April 20, 2024

29.1 Bunching for the outcome variable

Recently I read this paper, Caetano et al (2020) https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3699644. It’s about bunching.

Bunching is a phenomenon where we see a mass point in the distribution of some variable. For example, Saez (2010) studies a mass point in the distribution of earned income at the kink point of the tax schedule. This is because people bunch at the kink point to take advantage of the tax break.

Bunching is similar to regression discontinuity. In this blog, https://blogs.worldbank.org/en/impactevaluations/ready-set-bunch, “As noted by Kleven (2016), regression discontinuity (RD) is a close cousin of bunching estimators. In regression discontinuity, we maintain the assumption that there is no such “manipulation” as described above. Bunching relaxes this assumption — instead, we estimate the fraction of manipulators by estimating what densities of individuals would have been without manipulation, that is the “manipulation-free counterfactual”. With both the observed and manipulation-free counterfactual distributions of individuals estimated, it may be possible to compare the two distributions to recover the fraction of individuals who manipulated.”

The main idea is to compare the bunching with the counterfactual distribution without bunching to estimate elasticities, for example, how people react to tax rate.

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 \]

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 \]

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) \] or

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

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.

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. Let’s do a dummy test.

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. It means that \(T\) is endogenous.

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)} \]

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 — 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.