  We propose a test for the identification of causal effects in mediation and
dynamic treatment models that is based on two sets of observed variables,
namely covariates to be controlled for and suspected instruments, building on
the test by Huber and Kueck (2022) for single treatment models. We consider
models with a sequential assignment of a treatment and a mediator to assess the
direct treatment effect (net of the mediator), the indirect treatment effect
(via the mediator), or the joint effect of both treatment and mediator. We
establish testable conditions for identifying such effects in observational
data. These conditions jointly imply (1) the exogeneity of the treatment and
the mediator conditional on covariates and (2) the validity of distinct
instruments for the treatment and the mediator, meaning that the instruments do
not directly affect the outcome (other than through the treatment or mediator)
and are unconfounded given the covariates. Our framework extends to
post-treatment sample selection or attrition problems when replacing the
mediator by a selection indicator for observing the outcome, enabling joint
testing of the selectivity of treatment and attrition. We propose a machine
learning-based test to control for covariates in a data-driven manner and
analyze its finite sample performance in a simulation study. Additionally, we
apply our method to Slovak labor market data and find that our testable
implications are not rejected for a sequence of training programs typically
considered in dynamic treatment evaluations.
