Skip to content

Commit 1fc9c9d

Browse files
committed
Rel 0.1.0
1 parent 6b6a713 commit 1fc9c9d

6 files changed

Lines changed: 31 additions & 85 deletions

File tree

src/methods/induced_covariance_graph.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function ancester_graph(e::NamedArray)
1010
if sum(size(e)) == 0
1111
return(e)
1212
end
13-
indicator_matrix(Int.(inv(2 * I(size(e, 1)) - e)))
13+
indicator_matrix(Int.(round.(Int, inv(2 * I(size(e, 1)) - e))))
1414
end
1515

1616
"""

test/test_descendents_01.dot

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
digraph test_desc {
2+
v -> y;
3+
v -> x;
4+
y -> k;
5+
y -> w;
6+
k -> s2;
7+
z -> x;
8+
x -> u;
9+
w -> u;
10+
w -> s2;
11+
u -> s1;
12+
s1 -> s3;
13+
s3 -> s2;
14+
}

test/test_descendents_01.jl

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
using StructuralCausalModels
22

3+
ProjDir = @__DIR__
4+
35
d_str = "DAG(u ~ x + w, x ~ v + z, y ~ v, s1 ~ u, w ~ y, k ~ y, s2 ~ w + s3 + k, s3 ~ s1)"
46

57
dag = DAG("test_desc", d_str)
68

79
to_dagitty(dag) |> display
810

11+
#=
912
fname = joinpath(ProjDir, "test_descendents_01.dot")
1013
to_graphviz(dag, fname)
1114
Sys.isapple() && run(`open -a GraphViz.app $(fname)`)
15+
=#
1216

1317
display(dag)
1418
display(dag.a)
1519
println(dag.a[:x, :u])
1620
println(dag.e[:x, :u])
1721
println()
1822

19-
@show d_separation(dag, :x, :w)
20-
@show d_separation(dag, :x, :w; cset=:v)
21-
@show d_separation(dag, :x, :w; cset=:y)
22-
@show d_separation(dag, :x, :v; cset=:s3)
23-
println()
23+
bs = basis_set(dag)
24+
display(bs)
2425

25-
@show adjustment_sets(dag, :x, :w)
26-
@show adjustment_sets(dag, :x, :s1)
27-
@show adjustment_sets(dag, :x, :s2)
28-
@show adjustment_sets(dag, :u, :k)
29-
@show adjustment_sets(dag, :y, :s2)
26+
as = adjustment_sets(dag, :u, :s2)
27+
display(as)

test/test_descendents_02.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ dagitty_str = to_dagitty(dag)
88

99
fname = joinpath(ProjDir, "test_descendents_02.dot")
1010
to_graphviz(dag, fname)
11-
#Sys.isapple() && run(`open -a GraphViz.app $(fname)`)
11+
Sys.isapple() && run(`open -a GraphViz.app $(fname)`)
1212

1313
bs = basis_set(dag)
14+
display(bs)
15+
16+
as = adjustment_sets(dag, :u, :s2)
17+
display(as)

test/test_descendents_03.jl

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

16-
bs[9] |> display
17-
@show d_separation(dag, :x1, :x2; cset=[:v])
18-
println()
16+
as = adjustment_sets(dag, :x2, :y)
17+
display(as)
1918

20-
bs[10] |> display
21-
@show d_separation(dag, :x1, :x3)
22-
println()
23-
24-
bs[11] |> display
25-
@show d_separation(dag, :x1, :k1; cset=[:w])
26-
println()
27-
28-
bs[12] |> display
29-
@show d_separation(dag, :x1, :k2; cset=[:k2])
30-
println()
31-
32-
bs[13] |> display
33-
@show d_separation(dag, :x1, :y; cset=[:x2, :x3, :k2])
34-
println()
35-
36-
bs[1] |> display
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-
@show d_separation(dag, :k1, :y, cset=[:k2, :x2, :x3])
45-
@show d_separation(dag, :k1, :y, cset=[:k2, :v, :x3])
46-
@show d_separation(dag, :k1, :y, cset=[:k2, :x1, :x3])
47-
@show d_separation(dag, :k1, :y, cset=[:k2, :w])
48-
println()
49-
50-
@show d_separation(dag, :k2, :v, cset=[:x1])
51-
@show d_separation(dag, :k2, :v, cset=[:w])
52-
@show d_separation(dag, :k2, :v, cset=[:k1])
53-
@show d_separation(dag, :k2, :w, cset=[:k1])
54-
@show d_separation(dag, :k2, :x1, cset=[:w])
55-
@show d_separation(dag, :k2, :x1, cset=[:k1])
56-
@show d_separation(dag, :k2, :x2, cset=[:v])
57-
@show d_separation(dag, :k2, :x2, cset=[:x1])
58-
@show d_separation(dag, :k2, :x2, cset=[:w])
59-
@show d_separation(dag, :k2, :x2, cset=[:k1])
60-
@show d_separation(dag, :k2, :x3, cset=[:w])
61-
@show d_separation(dag, :k2, :x3, cset=[:k1])
62-
println()
63-
64-
@show d_separation(dag, :v, :w; cset=:x1)
65-
@show d_separation(dag, :v, :x3)
66-
@show d_separation(dag, :v, :y; cset=[:k2, :x2, :x3])
67-
@show d_separation(dag, :v, :y; cset=[:k1, :x2, :x3])
68-
@show d_separation(dag, :v, :y; cset=[:w, :x2, :x3])
69-
@show d_separation(dag, :v, :y; cset=[:x2, :x1])
70-
println()
71-
72-
@show d_separation(dag, :w, :x2; cset=[:v])
73-
@show d_separation(dag, :w, :x2; cset=[:x1])
74-
@show d_separation(dag, :w, :y; cset=[:k2, :x2, :x3])
75-
@show d_separation(dag, :w, :y; cset=[:k2, :v, :x3])
76-
@show d_separation(dag, :w, :y; cset=[:k1, :x2, :x3])
77-
@show d_separation(dag, :w, :y; cset=[:k1, :v, :x3])
78-
@show d_separation(dag, :w, :y; cset=[:k1, :x1, :x3])
79-
@show d_separation(dag, :w, :y; cset=[:k2, :x2, :x3])
80-
println()
81-
82-
@show d_separation(dag, :x1, :y; cset=[:k1, :v, :x3])
83-
@show d_separation(dag, :x1, :y; cset=[:v, :w, :x3])
84-
println()
85-
86-
@show d_separation(dag, :x2, :x3)
87-
println()
88-
89-
@show adjustment_sets(dag, :x2, :y)

test/test_open_paths_04.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ to_graphviz(dag, fname)
2323
:h => :i, :g => :h, :f => :g, :c => :f, :b => :c, :a => :b,
2424
:q => :r, :p => :q, :o => :p, :n => :o, :m => :n, :k => :l,
2525
:l => :m, :i => :k)
26+
2627
@test length(bs) == 272
2728
@test bs[3][1] == :D
2829
@test bs[3][2] == :a

0 commit comments

Comments
 (0)