causalens/cai-causal-graph

Minimal Ancestors not identified?

Closed this issue · 4 comments

Hi!

I'm experimenting with the package on a causal inference project I'm working on. I'm trying to identify confounders using the utility identify_confounders but I keep getting an empty set despite the manually proposed set of backdoor variables being confirmed by the DoWhy method CausalGraph.check_valid_backdoor_set.

So I'm a bit confused. I would have expected that the identify_confounders utility to provide a set of confounders if they exist. the method from DoWhy seems to confirm that they do in fact exist.

Consequently, I'm wondering if I'm misunderstanding something in the utility method.

here is a minimum example:

import networkx as nx
from cai_causal_graph.causal_graph import CausalGraph

from cai_causal_graph.identify_utils import identify_confounders


dag_edges = [
    ('T','m'),
    ('m','e'),
    ('T','tt'),
    ('tt','treatment'),
    ('I','treatment'),
    ('I','ic'),
    ('treatment','ic'),
    ('ic', 'p'),
    ('I','p'),
    ('p','e'),
    ('p','ce'), 
    ('I','soc'),
    ('soc','c'),
    ('c','ce'),
    ('ce','outcome'),
    ('e','outcome'),
]

G = nx.from_edgelist(dag_edges, create_using=nx.DiGraph)
cG = CausalGraph.from_networkx(G)

nx.draw_kamada_kawai(G, labels={k:k for k in G.nodes.keys()})

print(identify_confounders(cG, 'treatment', 'outcome'))

from dowhy.causal_graph import CausalGraph

cg = CausalGraph(treatment_name='treatment', outcome_name='outcome', graph=G)

print(cg.check_valid_backdoor_set(['treatment'], ['outcome'], set(['T','I']), dseparation_algo="naive"))

output:

[]
{'is_dseparated': True}

What am I missing here?

Thanks and happy new year!

Hi @arainboldt,

Thank you for raising the issue. We were able to reproduce and will investigate. This appears to be a bug. Please keep them coming if you find anything else 😄.

Happy new year to you as well!

Thanks again,
Andrew

Hey Andrew,

Thanks for the quick response!

Cheers,

Andrew

Hi Andrew (@arainboldt), we fixed this in the linked PR and released a patch version v0.3.14 with the fix. The docs were deployed as well to show the bug fix in the changelog. Thanks again for finding the issue and let us know if you notice anything else.

Wow! That's an amazing turn-around. And without an SLA! Too bad you guys don't run government services 😭