*! version 1.0.1 19may2019

*! first version 17april2019

*! changelog

*! version 1.0.1 added author affiliations and description of cluster robust inference (May 19, 2019)
help ivmediate (SJ21-1: st0611_1)

Title

ivmediate -- Causal mediation analysis for linear
instrumental-variables models

Syntax

ivmediate depvar [indepvars] [if] [in],
mediator(varname)
treatment(varname)
instrument(varname)
[options]

* mediator(varname) include a single mediator
variable

* treatment(varname) include a single treatment
variable

* instrument(varname) include a single instrumental
variable (IV)

absorb(varname) categorical variable to be absorbed

full display the full output including intermediate
regression results

vce(vcetype) may be robust or cluster clustvar; default is vce(unadjusted) standard errors

level(#) set level for confidence intervals; default is level(95)

* mediator(varname),
treatment(varname), and
instrument(varname) are required.

indepvars may contain factor variables; fvvarlist.

indepvars may contain time-series operators; see tsvarlist.

Description

ivmediate implements the causal mediation analysis framework for
linear IV models introduced by Dippel et al. (2019). It estimates three
effects:

i) the total effect of a single treatment T on an outcome Y, where T is
instrumented with a single IV Z, that is, a variable that affects Y only
through T,

ii) the direct effect of T on Y net of the effect of a mediator variable
M, and

iii) the indirect effect (mediation effect) of a third variable M through
which T affects Y.

The command allows for unpacking the treatment effect from a standard IV
regression into the direct and indirect effects of (potentially) endogenous
treatment and mediator variables without the need for an additional instrument
for the mediator variable. This compares with frameworks that require an
instrument for the mediator (Frölich and Huber 2017; Jun et al. 2016) or
those where random assignment of the treatment is assumed (Imai, Keele, and
Tingley 2010).

Results report two first-stage F statistics. These test for the relevance of
the instrument in the regression of the treatment on the instrument (T on Z)
-- that is, the standard first stage from a two-stage least squares regression
-- and in a regression of the mediator on the instrument controlling for the
treatment (M on Z|T), which is used in the estimation of the indirect effect
(for details, see Dippel et al. [2019]). If robust or cluster is
specified, the Kleibergen and Paap (2006) F statistic is reported. For a
discussion, see ivreg2.

Notice that exogenous controls in indepvars are partialled out using the
Frisch-Waugh-Lovell theorem to speed up estimation. Hence, they are not
reported in either the intermediate or final results tables.

Note: The ranktest command has to be installed by typing
ssc install ranktest prior to running ivmediate.

Options

mediator(varname) includes a single mediator variable.
mediator() is required.

treatment(varname) includes a single treatment variable.
treatment() is required.

instrument(varname) includes a single IV. instrument() is
required.

absorb(varname) allows the absorption of one fixed effect. For details,
see areg.

full displays intermediate results together with the main results.
Specifying this option will display three intermediate output tables:

1. the IV regression of Y on T (instrumented with Z)

2. the IV regression of M on T (instrumented with Z), for which the
first-stage F statistic is reported as first stage one in the main
table

3. the IV regression of Y on M (instrumented with Z) and controlling for T,
for which the first-stage F statistic is reported as first stage two in
the main table

The total effect is the coefficient on T in the first table; the direct effect
is the coefficient on T in the third table; the indirect effect is the product
of the coefficient on T in the second table and the coefficient on M in the
third. The mediation effect as percentage of the total effect is therefore
the indirect effect divided by the total effect times 100.

vce(vcetype) may be robust to estimate Eicker/Huber/White standard
errors or may be cluster clustervar to estimate cluster-robust
standard errors. The default is vce(unadjusted) standard errors.

level(#) specifies the confidence level, as a percentage, for confidence
intervals. Integers between 10 and 99 inclusive are allowed. The default is
level(95) or as set by set level.

Examples

Setup

. sysuse auto

IV mediation analysis

. ivmediate price, mediator(trunk) treatment(foreign) instrument(turn)

IV mediation analysis with display of intermediate results

. ivmediate price, mediator(trunk) treatment(foreign) instrument(turn) full

IV mediation analysis with controls and clustered standard errors

. ivmediate price mpg weight, mediator(trunk) treatment(foreign) instrument(turn) vce(cluster rep78)

Stored results

ivmediate stores the following in e():

Scalars
e(N) number of observations

e(fstat1) F statistic for the excluded instruments in first stage one (T on Z)

e(fstat2) F statistic for the excluded instruments in first stage two (M on Z|T)

e(mepct) mediation effect expressed as percentage of the total effect

e(N_clust) number of clusters used to adjust standard errors if cluster was specified in vce()

Macros
e(depvar) name of the dependent variable

e(treat) name of the treatment variable

e(med) name of the mediator variable

e(inst) name of the IV

e(vcetype) vcetype specified in vce()

e(clustvar) name of the cluster variable if cluster was specified in vce()

Matrices
e(b) coefficient vector

e(V) variance-covariance matrix

References

Dippel, C., R. Gold, S. Heblich, and R. Pinto. 2019. Mediation analysis in IV
settings with a single instrument.
https://www.anderson.ucla.edu/faculty_pages/christian.dippel/IVmediate.pdf.

Frölich, M., and M. Huber. 2017. Direct and indirect treatment
effects -- causal chains and mediation analysis with instrumental variables.
Journal of the Royal Statistical Society, Series B 79: 1645-1666.
https://doi.org/10.1111/rssb.12232.

Imai, K., L. Keele, and D. Tingley. 2010. A general approach to causal
mediation analysis. Psychological Methods 15: 309-334.
https://doi.org/10.1037/a0020761.

Jun, S. J., J. Pinkse, H. Xu, and N. Yildiz. 2016. Multiple discrete
endogenous variables in weakly-separable triangular models.
Econometrics 4: 7.
https://doi.org/10.3390/econometrics4010007.

Kleibergen, F., and R. Paap. 2006. Generalized reduced rank tests using the
singular value decomposition. Journal of Econometrics 133: 97-126.
https://doi.org/10.1016/j.jeconom.2005.02.011.

Authors

Christian Dippel

UCLA Anderson School of Management

Los Angeles, CA

christian.dippel@anderson.ucla.edu

Andreas Ferrara

University of Pittsburgh

Pittsburgh, PA

a.ferrara@pitt.edu

Stephan Heblich

University of Toronto

Toronto, Canada

stephan.heblich@utoronto.ca

Also see

Article: Stata Journal, volume 21, number 1: st0611_1,

Stata Journal, volume 20, number 3: st0611

Help: [R] gmm, ranktest (if installed)