Skip to content

Commit

Permalink
Updated IV check to explicitly use len
Browse files Browse the repository at this point in the history
  • Loading branch information
jmafoster1 authored Nov 27, 2024
1 parent f5400ee commit 75efc80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions causal_testing/specification/causal_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def check_iv_assumptions(self, treatment, outcome, instrument) -> bool:
(
cause
for cause in self.graph.nodes
if list(nx.all_simple_paths(self.graph, source=cause, target=instrument))
and list(nx.all_simple_paths(self.graph, source=cause, target=outcome))
if len(list(nx.all_simple_paths(self.graph, source=cause, target=instrument))) > 0
and len(list(nx.all_simple_paths(self.graph, source=cause, target=outcome))) > 0
)
):
raise ValueError(f"Instrument {instrument} and outcome {outcome} share common causes")
Expand Down

0 comments on commit 75efc80

Please sign in to comment.