def test_m_bias(self): model = parse_model_string([ "U₁[unobserved] -> Z", "U₁[unobserved] -> Y[outcome]", "U₂[unobserved] -> A[treatment]", "U₂[unobserved] -> Z", "A -> Y" ]) path = utils.node_path_to_edge_path(["A", "U₂", "Z", "U₁", "Y"], model.graph) is_blocked = model.is_path_blocked(path, conditioning_set=None) assert is_blocked
def test_simple_chain(self): model = parse_model_string(["x->b", "b->y"]) path = utils.node_path_to_edge_path(["x", "b", "y"], model.graph) is_blocked = model.is_path_blocked(path) assert not is_blocked
def test_simple_collider(self): model = parse_model_string(["x->b", "y->b"]) path = utils.node_path_to_edge_path(['x', 'b', 'y'], model.graph) is_blocked = model.is_path_blocked(path) assert is_blocked
def test_fork_chain_mix(self): model = parse_model_string(["x<-a", "a<-b", "c->b", "c->d", "d->y"]) path = utils.node_path_to_edge_path(["x", "a", "b", "c", "d", "y"], model.graph) is_blocked = model.is_path_blocked(path) assert not is_blocked
def test_simple_fork(self): model = parse_model_string(["b->x", "b->y"]) path = utils.node_path_to_edge_path(['x', 'b', 'y'], model.graph) is_blocked = model.is_path_blocked(path) assert not is_blocked
def test_long_chain(self): model = parse_model_string(["x->a", "a->b", "b->c", "c->d", "d->y"]) path = utils.node_path_to_edge_path(["x", "a", "b", "c", "d", "y"], model.graph) is_blocked = model.is_path_blocked(path) assert not is_blocked