Binary treatments and interaction effects
Source:vignettes/articles/binary-and-interactions.Rmd
binary-and-interactions.RmdA binary treatment
When the endogenous regressor is itself 0/1, its first stage is a probit and the average partial effect is a discrete change: the average difference in the probability of the outcome with the treatment switched on and off. apexog offers two estimators.
Control function with a probit first stage
(firststage = "probit"; in Stata
firststage(probit) or the i. prefix,
(i.certified = subsidy)). The control function is the
generalized residual of the first-stage probit. This is the estimator of
Stata’s cfprobit with a probit first stage, and apexog
reproduces it exactly, standard error included.
Recursive bivariate probit
(firststage = "biprobit"). The outcome and the treatment
are fitted jointly by maximum likelihood under bivariate normality of
their errors, with the violation as an offset in the outcome equation.
There is no generated regressor, so the standard errors are ordinary
maximum-likelihood ones. The output also reports the estimated error
correlation ρ.
A linear first stage is not a third route to a causal estimate. A 0/1
treatment cannot have the normal linear first stage the control-function
model assumes. apexog still fits it (it is the default in R when no
first stage is named, and in Stata when the regressor is written without
i.), but the result is a descriptive fitted contrast, and
the output says so.
The certification data were simulated with jointly
normal errors (correlation 0.5), and the true average effect of
certification on the probability of promotion is about 0.21:
data(certification)
cf <- apexog(promoted ~ tenure + manager, endog = certified ~ subsidy,
data = certification, firststage = "probit",
gmin = -0.10, gmax = 0.10, grid = 11, verbose = FALSE)
bp <- apexog(promoted ~ tenure + manager, endog = certified ~ subsidy,
data = certification, firststage = "biprobit",
gmin = -0.10, gmax = 0.10, grid = 11, verbose = FALSE)
rbind(control_function = cbind(cf$baseline[, c("estimate", "se")], confint(cf)),
bivariate_probit = cbind(bp$baseline[, c("estimate", "se")], confint(bp)))
#> estimate se lower upper
#> control_function 0.1996208 0.02949997 0.02038233 0.3813362
#> bivariate_probit 0.2163519 0.02650303 0.04807266 0.3846313
bp$rho
#>
#> 0.4592555Which one? The two rest on different assumptions, and neither set nests the other (Wooldridge 2014). The control function is consistent under Wooldridge’s sufficiency assumption, that the outcome error depends on the instrument and the treatment only through the generalized residual. It is only an approximation when the errors are jointly normal, the model the bivariate probit assumes. The approximation error grows with the correlation of the errors. In a large simulation (N = 400,000, true effect 0.211) the two-step estimate was:
| Error correlation | Control function | Bias | Bivariate probit | Bias |
|---|---|---|---|---|
| 0.3 | 0.205 | −2.7% | 0.211 | 0.0% |
| 0.5 | 0.186 | −11.6% | 0.210 | −0.4% |
| 0.8 | 0.104 | −50.6% | 0.211 | +0.1% |
So when you maintain joint normality of the outcome and treatment
errors, use the bivariate probit. apexog prints a note whenever a
generalized-residual control function is in use. The same caveat applies
to fractional ("fprobit") and count
("poisson") treatments, for which no exact alternative is
available. The bivariate probit handles one endogenous regressor; its
target is the average partial effect or, with a moderator, the average
interaction effect (see below).
Interaction effects
In a probit the effect of one regressor depends on the values of all
others, so the interaction of two variables is not read off a
coefficient. apexog targets the average interaction effect (AIE)
instead, averaged over the sample in the style of ginteff
(Radean 2023). Three cases, detected from the data or set with
aie_binary (in Stata with the c. and
i. prefixes in target()):
| Interactors | AIE |
|---|---|
| continuous × continuous | the average cross-partial derivative of the probability |
| continuous × binary | the change in the continuous variable’s average slope when the binary one switches from 0 to 1 |
| binary × binary | the average second difference of the probability |
Interactions of exogenous variables.
aie = c("x", "w") with both among the controls. apexog adds
the product x:w to the model (or uses it if the formula
already contains it, as in x * w).
An endogenous treatment and a moderator. When the
treatment is endogenous its product with a moderator is endogenous too,
and the product of the instrument and the moderator belongs in the
model. One way is to declare the product as a second endogenous
regressor, instrumented by the instrument and its product with the
moderator, and to point aie at the pair. apexog then adds
the product of the two control functions to the main probit
(cfprobit’s cfinteract). In the
promotion data training pays off more under a supportive
manager:
data(promotion)
aie <- apexog(promoted ~ tenure + manager,
endog = training + training:manager ~ subsidy + subsidy:manager,
data = promotion, aie = c("training", "manager"),
aie_binary = c(FALSE, TRUE),
gmin = -0.05, gmax = 0.05, grid = 5, verbose = FALSE)
aie
#> ------------------------------------------------------------------------------
#> Plausibly-exogenous AIE bounds (CHR 2012, UCI method)
#> Estimator: cfprobit | First stage: linear linear | SE: two-step | N = 4000
#> Target: Average Interaction Effect (training x manager): continuous-by-binary (first difference in manager)
#> ------------------------------------------------------------------------------
#> Baseline (gamma = 0):
#> AIE(training x manager) = 0.051042 (SE 0.012024) [0.027475, 0.074609]
#>
#> Scale: 1 latent-index unit of gamma = 0.2069 pr. points per unit of Z (avg., baseline)
#> 1 structural-latent unit of gamma = 1.2033 latent-index units (sigma_tilde = 0.8310)
#>
#> UCI union over gamma grid (5 point(s) per instrument):
#> gamma_subsidy range: [-0.0500, 0.0500] exact Pr scale: [-0.0103, 0.0103]
#> gamma_subsidy:manager range: [-0.0500, 0.0500] exact Pr scale: [-0.0103, 0.0103]
#>
#> AIE(training x manager) bounds = [0.018002, 0.087606]
#> ------------------------------------------------------------------------------The violation is now allowed on both instruments, the subsidy and its
product with manager, each within ±0.05. With
aie_binary = c(FALSE, TRUE) the AIE is the difference in
training’s average slope between employees with and without a supportive
manager: 0.051 at γ = 0, and between 0.018 and 0.088 over the
range. The same model in Stata:
apexog uci promoted tenure manager ///
(c.training c.training#c.manager = subsidy c.subsidy#i.manager), ///
target(c.training#i.manager) gmin(-0.05) gmax(0.05) grid(5)Baseline (gamma = 0):
AIE(training ## manager) = 0.051042 (SE 0.012024) [ 0.027475, 0.074609]
...
AIE(training ## manager) bounds = [ 0.018002, 0.087606]
The control functions are held at their observed values when the
moderator is switched, as in ginteff after the
corresponding probit.
The other way keeps the treatment alone, with the interacted
instrument in its first stage:
endog = training ~ subsidy + subsidy:manager (in Stata
(c.training = subsidy c.subsidy#i.manager)). The control
function of training then covers its product with
manager, which needs no first stage of its own (Wooldridge
2015, pp. 428–429, 437). The interacted instrument is still needed: it
lets the first stage of training differ with
manager, and without it the control function, and with it
the AIE, is wrong whenever the subsidy moves training differently for
the two groups of employees. In the promotion data this
form gives an AIE of 0.048 (SE 0.009) at γ = 0, against 0.051
(SE 0.012) above.
A binary treatment and a moderator. The construction
above needs a continuous treatment: a 0/1 treatment cannot have a normal
linear first stage, and its product with the moderator is a function of
the two, so giving the product a first stage of its own defines no
structural model (apexog prints a note when you try). Use the bivariate
probit instead. Write the treatment alone in endog, keep
the moderator among the controls and point aie at the pair;
the product then enters only the outcome equation of the joint fit. The
instruments may include the product of an instrument and the moderator,
whose violation is then allowed for separately. In the
certification data:
data(certification)
bpi <- apexog(promoted ~ tenure + manager,
endog = certified ~ subsidy + subsidy:manager,
data = certification, firststage = "biprobit",
aie = c("certified", "manager"),
gmin = c(-0.1, 0), gmax = c(0.1, 0), grid = 5, verbose = FALSE)
bpi
#> ------------------------------------------------------------------------------
#> Plausibly-exogenous AIE bounds (CHR 2012, UCI method)
#> Estimator: biprobit (recursive bivariate probit, MLE) | SE: delta method | N = 4000
#> Target: Average Interaction Effect (certified x manager): binary-by-binary (second discrete difference)
#> ------------------------------------------------------------------------------
#> Baseline (gamma = 0):
#> AIE(certified x manager) = -0.001289 (SE 0.029238) [-0.058595, 0.056016]
#>
#> Scale: 1 latent-index unit of gamma = 0.3405 pr. points per unit of Z (avg., baseline)
#> 1 structural-latent unit of gamma = 1.0000 latent-index units (sigma_tilde = 1.0000)
#> biprobit: structural and index scales coincide (sigma_tilde = 1);
#> rho(eps_y, eps_d) at the baseline fit = 0.4598
#>
#> UCI union over gamma grid (5 point(s) per instrument):
#> gamma_subsidy range: [-0.1000, 0.1000] exact Pr scale: [-0.0325, 0.0351]
#> gamma_subsidy:manager range: [0.0000, 0.0000] exact Pr scale: [0.0000, 0.0000]
#>
#> AIE(certified x manager) bounds = [-0.066247, 0.063972]
#> ------------------------------------------------------------------------------The AIE is now the second difference of the average structural function under joint normality of the outcome and treatment errors, the model the bivariate probit maintains. The model has one error correlation and one treatment equation for both values of the moderator. Under that restriction the interaction is also identified from treatment variation the instrument does not generate, so it can be much more precise than an instrumental-variable contrast and can differ from it; when the estimated correlation is near zero it is close to the AIE of a probit that treats the treatment as exogenous. In Stata:
References
Radean, M. (2023). ginteff: A generalized command for computing interaction effects. Stata Journal, 23(2), 301–335. https://doi.org/10.1177/1536867X231175253
Wooldridge, J. M. (2014). Quasi-maximum likelihood estimation and testing for nonlinear models with endogenous explanatory variables. Journal of Econometrics, 182(1), 226–234. https://doi.org/10.1016/j.jeconom.2014.04.020