Skip to content

Commit

Permalink
build based on e2fcd38
Browse files Browse the repository at this point in the history
  • Loading branch information
zeptodoctor committed Sep 4, 2024
1 parent 1983988 commit 8e41a85
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion dev/comments/index.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Developer comments · CausalInference.jl</title><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit">CausalInference.jl</span></div><form class="docs-search" action="../search/"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../">Home</a></li><li><span class="tocitem">Examples</span><ul><li><a class="tocitem" href="../examples/pc_basic_examples/">PC Algorithm: Basic examples</a></li><li><a class="tocitem" href="../examples/ges_basic_examples/">Score based algorithms</a></li><li><a class="tocitem" href="../examples/pc_cmi_examples/">PC Algorithm: Further examples</a></li><li><a class="tocitem" href="../examples/pc_real_example/">PC Algorithm: Example using real data</a></li><li><a class="tocitem" href="../examples/backdoor_example/">Reasoning about experiments (Backdoors and adjustments)</a></li></ul></li><li><a class="tocitem" href="../library/">Library</a></li><li class="is-active"><a class="tocitem" href>Developer comments</a><ul class="internal"><li><a class="tocitem" href="#Whether-to-use-Meek&#39;s-or-Chickerings-completion-algorithm.-1"><span>Whether to use Meek&#39;s or Chickerings completion algorithm.</span></a></li><li><a class="tocitem" href="#On-Meek&#39;s-rule-4-1"><span>On Meek&#39;s rule 4</span></a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Developer comments</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Developer comments</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/mschauer/CausalInference.jl/blob/master/docs/src/comments.md" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Developer-comments-1"><a class="docs-heading-anchor" href="#Developer-comments-1">Developer comments</a><a class="docs-heading-anchor-permalink" href="#Developer-comments-1" title="Permalink"></a></h1><h2 id="Whether-to-use-Meek&#39;s-or-Chickerings-completion-algorithm.-1"><a class="docs-heading-anchor" href="#Whether-to-use-Meek&#39;s-or-Chickerings-completion-algorithm.-1">Whether to use Meek&#39;s or Chickerings completion algorithm.</a><a class="docs-heading-anchor-permalink" href="#Whether-to-use-Meek&#39;s-or-Chickerings-completion-algorithm.-1" title="Permalink"></a></h2><p>Meek&#39;s approach we currently use in PC and GES is: Take the PDAG and apply R1-R4 repeatedly until no rule applies. To obtain the CPDAG from a pattern the rules R1-R3 suffice, R4 is not needed.</p><p>Chickering&#39;s approach is to take the PDAG and find a DAG with same skeleton and v-structures. (This can be done e.g. with this algorithm by Dor and Tarsi: https://ftp.cs.ucla.edu/pub/stat_ser/r185-dor-tarsi.pdf) From the DAG construct the CPDAG (which is possible in linear-time, we also have this implemented cpdag(g)).</p><p>Implementing Chickerings approach would be an option because the complicated part (from an implementation perspective) is DAG-to-CPDAG which we already have. A straightforward implementation of PDAG to DAG by Dor and Tarsi are just a few lines. For speed of PC and GES this will likely not matter too much overall, other parts are more costly in case of PC the pattern learned from data might not have a DAG with same skeleton and v-structures. Then, it is not clear how to use Chickerings approach. </p><h2 id="On-Meek&#39;s-rule-4-1"><a class="docs-heading-anchor" href="#On-Meek&#39;s-rule-4-1">On Meek&#39;s rule 4</a><a class="docs-heading-anchor-permalink" href="#On-Meek&#39;s-rule-4-1" title="Permalink"></a></h2><p>R4 is only needed in case of background knowledge, i.e. some edge orientations which do not follow from v-structures. For soundness of the rule, it is necessary that v and l are adjacent. For completeness of the Meek rules it suffices to apply it only if there is an undirected edge.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../library/">« Library</a></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Tuesday 3 September 2024 16:01">Tuesday 3 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Developer comments · CausalInference.jl</title><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit">CausalInference.jl</span></div><form class="docs-search" action="../search/"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../">Home</a></li><li><span class="tocitem">Examples</span><ul><li><a class="tocitem" href="../examples/pc_basic_examples/">PC Algorithm: Basic examples</a></li><li><a class="tocitem" href="../examples/ges_basic_examples/">Score based algorithms</a></li><li><a class="tocitem" href="../examples/pc_cmi_examples/">PC Algorithm: Further examples</a></li><li><a class="tocitem" href="../examples/pc_real_example/">PC Algorithm: Example using real data</a></li><li><a class="tocitem" href="../examples/backdoor_example/">Reasoning about experiments (Backdoors and adjustments)</a></li></ul></li><li><a class="tocitem" href="../library/">Library</a></li><li class="is-active"><a class="tocitem" href>Developer comments</a><ul class="internal"><li><a class="tocitem" href="#Whether-to-use-Meek&#39;s-or-Chickerings-completion-algorithm.-1"><span>Whether to use Meek&#39;s or Chickerings completion algorithm.</span></a></li><li><a class="tocitem" href="#On-Meek&#39;s-rule-4-1"><span>On Meek&#39;s rule 4</span></a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Developer comments</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Developer comments</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/mschauer/CausalInference.jl/blob/master/docs/src/comments.md" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Developer-comments-1"><a class="docs-heading-anchor" href="#Developer-comments-1">Developer comments</a><a class="docs-heading-anchor-permalink" href="#Developer-comments-1" title="Permalink"></a></h1><h2 id="Whether-to-use-Meek&#39;s-or-Chickerings-completion-algorithm.-1"><a class="docs-heading-anchor" href="#Whether-to-use-Meek&#39;s-or-Chickerings-completion-algorithm.-1">Whether to use Meek&#39;s or Chickerings completion algorithm.</a><a class="docs-heading-anchor-permalink" href="#Whether-to-use-Meek&#39;s-or-Chickerings-completion-algorithm.-1" title="Permalink"></a></h2><p>Meek&#39;s approach we currently use in PC and GES is: Take the PDAG and apply R1-R4 repeatedly until no rule applies. To obtain the CPDAG from a pattern the rules R1-R3 suffice, R4 is not needed.</p><p>Chickering&#39;s approach is to take the PDAG and find a DAG with same skeleton and v-structures. (This can be done e.g. with this algorithm by Dor and Tarsi: https://ftp.cs.ucla.edu/pub/stat_ser/r185-dor-tarsi.pdf) From the DAG construct the CPDAG (which is possible in linear-time, we also have this implemented cpdag(g)).</p><p>Implementing Chickerings approach would be an option because the complicated part (from an implementation perspective) is DAG-to-CPDAG which we already have. A straightforward implementation of PDAG to DAG by Dor and Tarsi are just a few lines. For speed of PC and GES this will likely not matter too much overall, other parts are more costly in case of PC the pattern learned from data might not have a DAG with same skeleton and v-structures. Then, it is not clear how to use Chickerings approach. </p><h2 id="On-Meek&#39;s-rule-4-1"><a class="docs-heading-anchor" href="#On-Meek&#39;s-rule-4-1">On Meek&#39;s rule 4</a><a class="docs-heading-anchor-permalink" href="#On-Meek&#39;s-rule-4-1" title="Permalink"></a></h2><p>R4 is only needed in case of background knowledge, i.e. some edge orientations which do not follow from v-structures. For soundness of the rule, it is necessary that v and l are adjacent. For completeness of the Meek rules it suffices to apply it only if there is an undirected edge.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../library/">« Library</a></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Wednesday 4 September 2024 12:54">Wednesday 4 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
2 changes: 1 addition & 1 deletion dev/examples/backdoor_example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
t = plot_pc_graph_tikz(dag)</code></pre><p>We are interested in the average causal effect (ACE) of a treatment <code>X</code> (variable nr. 6) on an outcome <code>Y</code> (variable nr. 8), which stands for the expected increase of <code>Y</code> per unit of a controlled increase in <code>X</code>. Variables nr. 1 and nr. 2 are unobserved.</p><p><em>Regressing <code>Y</code> (nr. 8) on <code>X</code> (nr. 6) will fail to measure the effect because of the presence of a confounder <code>C</code> (variable nr. 4)</em>, which opens a backdoor path, a connection between <code>X</code> and <code>Y</code> via the path 6 ← 4 → 8 which is not causal. </p><p><img src="https://raw.githubusercontent.com/mschauer/CausalInference.jl/master/assets/backdoor1.png" alt="Confounder"/></p><p>We can avert such problems by checking the backdoor criterion. Indeed</p><pre><code class="language-julia">backdoor_criterion(dag, 6, 8) # false</code></pre><p>reports a problem.</p><p>One might want to condition on the confounder <code>C</code> (nr. 4)` to obtain the causal effect, but then </p><pre><code class="language-julia">backdoor_criterion(dag, 6, 8, [4]) # still false</code></pre><p>there is still a problem ( because that conditioning opens up a non-causal path via 6 ← 3 ← 1 → 4 ← 2 → 5 → 8.)</p><p><img src="https://raw.githubusercontent.com/mschauer/CausalInference.jl/master/assets/backdoor2.png" alt="Opened new path"/></p><p>But conditioning on both <code>Z = [4, 5]</code> solves the problem, as verified by the backdoor criterion.</p><pre><code class="language-julia">backdoor_criterion(dag, 6, 8, [3, 4]) # true
backdoor_criterion(dag, 6, 8, [4, 5]) # true</code></pre><p>(also conditioning on <code>Z = [3, 4]</code> would be possible.)</p><p>Thus, regressing <code>Y</code> on <code>X</code> and controlling for variables numbered <code>Z = [4, 5]</code> we measure the average causal effect.</p><p><img src="https://raw.githubusercontent.com/mschauer/CausalInference.jl/master/assets/backdoor3.png" alt="Good controls"/></p><p>What we have done by hand here is the search for an backdoor adjustment set. We could have directly queried</p><pre><code class="language-julia">Zs = list_covariate_adjustment(dag, 6, 8, Int[], setdiff(Set(1:8), [1, 2])) # exclude variables nr. 1 and nr. 2 because they are unobserved.</code></pre><p>which lists possible adjustment sets,</p><pre><code class="language-julia">println.(Zs);</code></pre><pre><code class="language-none"> Set([4, 3])
Set([5, 4])
Set([5, 4, 3])</code></pre><p>to get the list of possible adjustment sets. Here <code>list_backdoor_adjustment</code> gives adjustment sets for a backdoor criterion similar to <code>backdoor_criterion</code> and <code>list_covariate_adjustment</code> the more versatile adjustment set based on the sound and complete graphical criterion for covariate adjustment given in [https://arxiv.org/abs/1203.3515] using the algorithmic approach proposed in [https://arxiv.org/abs/1803.00116]. </p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../pc_real_example/">« PC Algorithm: Example using real data</a><a class="docs-footer-nextpage" href="../../library/">Library »</a></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Tuesday 3 September 2024 16:01">Tuesday 3 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Set([5, 4, 3])</code></pre><p>to get the list of possible adjustment sets. Here <code>list_backdoor_adjustment</code> gives adjustment sets for a backdoor criterion similar to <code>backdoor_criterion</code> and <code>list_covariate_adjustment</code> the more versatile adjustment set based on the sound and complete graphical criterion for covariate adjustment given in [https://arxiv.org/abs/1203.3515] using the algorithmic approach proposed in [https://arxiv.org/abs/1803.00116]. </p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../pc_real_example/">« PC Algorithm: Example using real data</a><a class="docs-footer-nextpage" href="../../library/">Library »</a></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Wednesday 4 September 2024 12:54">Wednesday 4 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit 8e41a85

Please sign in to comment.