Repository navigation
Mediation analysis: Does the "mediation.two_stage_regression" method handle partial mediation? #1287
Replies: 1 comment
|
Yes to both. The "fully mediated" line in that docstring is about using the estimator for front-door identification of the total effect. For mediation you choose the estimand, and the natural direct effect is the from dowhy.causal_estimators.linear_regression_estimator import LinearRegressionEstimator
params = {"first_stage_model": LinearRegressionEstimator,
"second_stage_model": LinearRegressionEstimator}
nie = model.identify_effect(estimand_type="nonparametric-nie", proceed_when_unidentifiable=True)
nde = model.identify_effect(estimand_type="nonparametric-nde", proceed_when_unidentifiable=True)
for estimand in (nie, nde):
est = model.estimate_effect(estimand, method_name="mediation.two_stage_regression",
confidence_intervals=False, test_significance=False,
method_params=params)
print(est.value)On simulated data with a binary T, the graph |
Uh oh!
There was an error while loading. Please reload this page.
In the discussion on mediation analysis
(https://www.pywhy.org/dowhy/v0.12/user_guide/causal_tasks/quantify_causal_influence/mediation_analysis.html), "mediation.two_stage_regression" is used as the only currently available method for estimating the effect.
The description of the estimator
(https://www.pywhy.org/dowhy/v0.12/dowhy.causal_estimators.html#module-dowhy.causal_estimators.two_stage_regression_estimator) says: "Compute treatment effect whenever the effect is fully mediated by another variable (front-door) or when there is an instrument available." (Emphasis on fully)
This case for full mediation seems true for the example shown in the mediation analysis link above, where the DAG represents the relationship: Treatment (T) ---> Mediator (M) ---> Outcome (Y). The only path from T to Y is via M.
My questions are: can I use the same effect estimation method (two stage regression) for mediation analysis -
and
Thank you!
All reactions