dowhy icon indicating copy to clipboard operation
dowhy copied to clipboard

Issue with parallel mediators/multiple directed paths

Open dafxy opened this issue 5 months ago • 0 comments

It is ignoring mediator M2:

import dowhy

vertices = ['D', 'M1', 'M2', 'Y']
dag = """
D -> {M1, M2, Y}
M1 -> Y
M2 -> Y
"""

G = dowhy.CausalModel(data=pd.DataFrame(columns=vertices),
                        graph=f"digraph{{{dag}}}",
                        treatment = "D",
                        outcome="Y",
                        )
print(G.identify_effect(estimand_type='nonparametric-nie'))

Estimand type: EstimandType.NONPARAMETRIC_NIE

### Estimand : 1
Estimand name: mediation
Estimand expression:
 ⎡  d       d        ⎤
E⎢─────(Y)⋅────([M₁])⎥
 ⎣d[M₁]    d[D]      ⎦
Estimand assumption 1, Mediation: M1 intercepts (blocks) all directed paths from D to Y except the path {D}→{Y}.
Estimand assumption 2, First-stage-unconfoundedness: If U→{D} and U→{M1} then P(M1|D,U) = P(M1|D)
Estimand assumption 3, Second-stage-unconfoundedness: If U→{M1} and U→Y then P(Y|M1, D, U) = P(Y|M1, D)

dafxy avatar Jul 24 '25 21:07 dafxy