Skip to content

Commit 7612020

Browse files
committed
Rel 0.1.0
1 parent 5e942e6 commit 7612020

5 files changed

Lines changed: 119 additions & 42 deletions

File tree

test/test_bases_set_01.jl

Lines changed: 0 additions & 19 deletions
This file was deleted.

test/test_basis_set_01.jl

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
using StructuralCausalModels, Test
2+
3+
ProjDir = @__DIR__
4+
5+
d_str = "dag{k1 -> k2;k2 -> y;v -> x2;w -> k1;x1 -> v;x1 -> w;x2 -> y;x3 -> w;x3 -> y}"
6+
7+
dag = DAG("test_desc", d_str)
8+
9+
to_dagitty(dag) |> display
10+
11+
#=
12+
fname = joinpath(ProjDir, "test_descendents_03.dot")
13+
to_graphviz(dag, fname)
14+
Sys.isapple() && run(`open -a GraphViz.app $(fname)`)
15+
=#
16+
17+
display(dag)
18+
19+
bs = basis_set(dag)
20+
bs |> display
21+
22+
show(ConditionalIndependency(bs[1]))
23+
@show d_separation(dag, :k1, :y, cset=[:w, :k2, :x2, :x3])
24+
@show d_separation(dag, :k1, :y, cset=[:k2, :x1, :x3])
25+
@show d_separation(dag, :k1, :y, cset=[:k2, :x2, :x3])
26+
@show d_separation(dag, :k1, :y, cset=[:k2, :x2, :x3])
27+
@show d_separation(dag, :k1, :y, cset=[:k2, :v, :x3])
28+
@show d_separation(dag, :k1, :y, cset=[:k2, :x1, :x3])
29+
@show d_separation(dag, :k1, :y, cset=[:k2, :x1])
30+
@show d_separation(dag, :k1, :y, cset=[:k2, :x3])
31+
@show d_separation(dag, :k1, :y, cset=[:k2, :w])
32+
@show d_separation(dag, :k1, :y, cset=[:w])
33+
@show d_separation(dag, :k1, :y, cset=[:k2])
34+
println()
35+
36+
#=
37+
@show d_separation(dag, :k1, :v, cset=[:x1])
38+
@show d_separation(dag, :k1, :v, cset=[:w])
39+
@show d_separation(dag, :k1, :x1, cset=[:w])
40+
@show d_separation(dag, :k1, :x2, cset=[:v])
41+
@show d_separation(dag, :k1, :x2, cset=[:x1])
42+
@show d_separation(dag, :k1, :x2, cset=[:w])
43+
@show d_separation(dag, :k1, :x3, cset=[:w])
44+
45+
bs[9] |> display
46+
@show d_separation(dag, :x1, :x2; cset=[:v])
47+
println()
48+
49+
bs[10] |> display
50+
@show d_separation(dag, :x1, :x3)
51+
println()
52+
53+
bs[11] |> display
54+
@show d_separation(dag, :x1, :k1; cset=[:w])
55+
println()
56+
57+
bs[12] |> display
58+
@show d_separation(dag, :x1, :k2; cset=[:k2])
59+
println()
60+
61+
bs[13] |> display
62+
@show d_separation(dag, :x1, :y; cset=[:x2, :x3, :k2])
63+
println()
64+
65+
@show d_separation(dag, :k2, :v, cset=[:x1])
66+
@show d_separation(dag, :k2, :v, cset=[:w])
67+
@show d_separation(dag, :k2, :v, cset=[:k1])
68+
@show d_separation(dag, :k2, :w, cset=[:k1])
69+
@show d_separation(dag, :k2, :x1, cset=[:w])
70+
@show d_separation(dag, :k2, :x1, cset=[:k1])
71+
@show d_separation(dag, :k2, :x2, cset=[:v])
72+
@show d_separation(dag, :k2, :x2, cset=[:x1])
73+
@show d_separation(dag, :k2, :x2, cset=[:w])
74+
@show d_separation(dag, :k2, :x2, cset=[:k1])
75+
@show d_separation(dag, :k2, :x3, cset=[:w])
76+
@show d_separation(dag, :k2, :x3, cset=[:k1])
77+
println()
78+
79+
@show d_separation(dag, :v, :w; cset=:x1)
80+
@show d_separation(dag, :v, :x3)
81+
@show d_separation(dag, :v, :y; cset=[:k2, :x2, :x3])
82+
@show d_separation(dag, :v, :y; cset=[:k1, :x2, :x3])
83+
@show d_separation(dag, :v, :y; cset=[:w, :x2, :x3])
84+
@show d_separation(dag, :v, :y; cset=[:x2, :x1])
85+
println()
86+
87+
@show d_separation(dag, :w, :x2; cset=[:v])
88+
@show d_separation(dag, :w, :x2; cset=[:x1])
89+
@show d_separation(dag, :w, :y; cset=[:k2, :x2, :x3])
90+
@show d_separation(dag, :w, :y; cset=[:k2, :v, :x3])
91+
@show d_separation(dag, :w, :y; cset=[:k1, :x2, :x3])
92+
@show d_separation(dag, :w, :y; cset=[:k1, :v, :x3])
93+
@show d_separation(dag, :w, :y; cset=[:k1, :x1, :x3])
94+
@show d_separation(dag, :w, :y; cset=[:k2, :x2, :x3])
95+
println()
96+
97+
@show d_separation(dag, :x1, :y; cset=[:k1, :v, :x3])
98+
@show d_separation(dag, :x1, :y; cset=[:v, :w, :x3])
99+
println()
100+
101+
@show d_separation(dag, :x2, :x3)
102+
println()
103+
=#

test/test_descendents.dot

Lines changed: 0 additions & 11 deletions
This file was deleted.

test/test_descendents_03.jl

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,27 @@ Sys.isapple() && run(`open -a GraphViz.app $(fname)`)
1313
bs = basis_set(dag)
1414
bs |> display
1515

16+
bs[9] |> display
1617
@show d_separation(dag, :x1, :x2; cset=[:v])
18+
println()
19+
20+
bs[10] |> display
1721
@show d_separation(dag, :x1, :x3)
22+
println()
23+
24+
bs[11] |> display
1825
@show d_separation(dag, :x1, :k1; cset=[:w])
19-
@show d_separation(dag, :x1, :k2; cset=[:x2])
20-
@show d_separation(dag, :x1, :y; cset=[:x2, :x3, :k2])
26+
println()
27+
28+
bs[12] |> display
29+
@show d_separation(dag, :x1, :k2; cset=[:k2])
30+
println()
2131

22-
bs[5] |> display
32+
bs[13] |> display
33+
@show d_separation(dag, :x1, :y; cset=[:x2, :x3, :k2])
34+
println()
2335

36+
bs[1] |> display
2437
@show d_separation(dag, :k1, :v, cset=[:x1])
2538
@show d_separation(dag, :k1, :v, cset=[:w])
2639
@show d_separation(dag, :k1, :x1, cset=[:w])

test/test_open_paths_02

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)