예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
 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
예제 #4
0
 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
예제 #5
0
 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
예제 #6
0
 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