|
| 1 | +using StructuralCausalModels, Test |
| 2 | + |
| 3 | +ProjDir = @__DIR__ |
| 4 | +cd(ProjDir) #do |
| 5 | + |
| 6 | +ProjDir = @__DIR__ |
| 7 | + |
| 8 | +d_str = "dag{k1 -> k2;k2 -> y;v -> x2;w -> k1;x1 -> v;x1 -> w;x2 -> y;x3 -> w;x3 -> y}" |
| 9 | + |
| 10 | +dag = DAG("test_desc_02", d_str) |
| 11 | + |
| 12 | +@testset "m_separation_03" begin |
| 13 | + |
| 14 | + @test m_separation(dag, :k1, :v, c=[:x1]) == true |
| 15 | + @test m_separation(dag, :k1, :v, c=[:w]) == true |
| 16 | + @test m_separation(dag, :k1, :x1, c=[:w]) == true |
| 17 | + @test m_separation(dag, :k1, :x2, c=[:v]) == true |
| 18 | + @test m_separation(dag, :k1, :x2, c=[:x1]) == true |
| 19 | + @test m_separation(dag, :k1, :x2, c=[:w]) == true |
| 20 | + @test m_separation(dag, :k1, :x3, c=[:w]) == true |
| 21 | + @test m_separation(dag, :k1, :y, c=[:k2, :x2, :x3]) == true |
| 22 | + @test m_separation(dag, :k1, :y, c=[:k2, :v, :x3]) == true |
| 23 | + @test m_separation(dag, :k1, :y, c=[:k2, :x1, :x3]) == true |
| 24 | + @test m_separation(dag, :k1, :y, c=[:k2, :w]) == true |
| 25 | + @test m_separation(dag, :k2, :v, c=[:x1]) == true |
| 26 | + @test m_separation(dag, :k2, :v, c=[:w]) == true |
| 27 | + @test m_separation(dag, :k2, :v, c=[:k1]) == true |
| 28 | + @test m_separation(dag, :k2, :w, c=[:k1]) == true |
| 29 | + @test m_separation(dag, :k2, :x1, c=[:w]) == true |
| 30 | + @test m_separation(dag, :k2, :x1, c=[:k1]) == true |
| 31 | + @test m_separation(dag, :k2, :x2, c=[:v]) == true |
| 32 | + @test m_separation(dag, :k2, :x2, c=[:x1]) == true |
| 33 | + @test m_separation(dag, :k2, :x2, c=[:w]) == true |
| 34 | + @test m_separation(dag, :k2, :x2, c=[:k1]) == true |
| 35 | + @test m_separation(dag, :k2, :x3, c=[:w]) == true |
| 36 | + @test m_separation(dag, :k2, :x3, c=[:k1]) == true |
| 37 | + @test m_separation(dag, :v, :w; c=:x1) == true |
| 38 | + @test m_separation(dag, :v, :x3) == true |
| 39 | + @test m_separation(dag, :v, :y; c=[:k2, :x2, :x3]) == true |
| 40 | + @test m_separation(dag, :v, :y; c=[:k1, :x2, :x3]) == true |
| 41 | + @test m_separation(dag, :v, :y; c=[:w, :x2, :x3]) == true |
| 42 | + @test m_separation(dag, :v, :y; c=[:x2, :x1]) == true |
| 43 | + @test m_separation(dag, :w, :x2; c=[:v]) == true |
| 44 | + @test m_separation(dag, :w, :x2; c=[:x1]) == true |
| 45 | + @test m_separation(dag, :w, :y; c=[:k2, :x2, :x3]) == true |
| 46 | + @test m_separation(dag, :w, :y; c=[:k2, :v, :x3]) == true |
| 47 | + @test m_separation(dag, :w, :y; c=[:k1, :x2, :x3]) == true |
| 48 | + @test m_separation(dag, :w, :y; c=[:k1, :v, :x3]) == true |
| 49 | + @test m_separation(dag, :w, :y; c=[:k1, :x1, :x3]) == true |
| 50 | + @test m_separation(dag, :w, :y; c=[:k2, :x2, :x3]) == true |
| 51 | + @test m_separation(dag, :x1, :x2; c=[:v]) == true |
| 52 | + @test m_separation(dag, :x1, :x3) == true |
| 53 | + @test m_separation(dag, :x1, :y; c=[:k2, :x2, :x3]) == true |
| 54 | + @test m_separation(dag, :x1, :y; c=[:k1, :x2, :x3]) == true |
| 55 | + @test m_separation(dag, :x1, :y; c=[:w, :x2, :x3]) == true |
| 56 | + @test m_separation(dag, :x1, :y; c=[:k2, :v, :x3]) == true |
| 57 | + @test m_separation(dag, :x1, :y; c=[:k1, :v, :x3]) == true |
| 58 | + @test m_separation(dag, :x1, :y; c=[:v, :w, :x3]) == true |
| 59 | + @test m_separation(dag, :x2, :x3) == true |
| 60 | + |
| 61 | +end |
0 commit comments