Commit 99dd3d3e authored by Gilles Kratzer's avatar Gilles Kratzer
Browse files

update: website with SHD

parent 96757e50
Pipeline #2547 passed with stage
in 3 seconds
......@@ -158,7 +158,7 @@
<p>Below is the summary of the MCMC run:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/summary.html">summary</a></span>(out)</a>
<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="co">#&gt; MCMC summary:</span></a>
<a class="sourceLine" id="cb4-3" data-line-number="3"><span class="co">#&gt; Number of Burn in steps: 0</span></a>
<a class="sourceLine" id="cb4-3" data-line-number="3"><span class="co">#&gt; Number of burn-in steps: 0</span></a>
<a class="sourceLine" id="cb4-4" data-line-number="4"><span class="co">#&gt; Number of MCMC steps: 1000</span></a>
<a class="sourceLine" id="cb4-5" data-line-number="5"><span class="co">#&gt; Thinning: 0</span></a>
<a class="sourceLine" id="cb4-6" data-line-number="6"><span class="co">#&gt; </span></a>
......@@ -210,7 +210,7 @@
<a class="sourceLine" id="cb5-13" data-line-number="13"></a>
<a class="sourceLine" id="cb5-14" data-line-number="14"><span class="kw"><a href="https://rdrr.io/r/base/summary.html">summary</a></span>(out1)</a>
<a class="sourceLine" id="cb5-15" data-line-number="15"><span class="co">#&gt; MCMC summary:</span></a>
<a class="sourceLine" id="cb5-16" data-line-number="16"><span class="co">#&gt; Number of Burn in steps: 0</span></a>
<a class="sourceLine" id="cb5-16" data-line-number="16"><span class="co">#&gt; Number of burn-in steps: 0</span></a>
<a class="sourceLine" id="cb5-17" data-line-number="17"><span class="co">#&gt; Number of MCMC steps: 1000</span></a>
<a class="sourceLine" id="cb5-18" data-line-number="18"><span class="co">#&gt; Thinning: 0</span></a>
<a class="sourceLine" id="cb5-19" data-line-number="19"><span class="co">#&gt; </span></a>
......@@ -257,7 +257,7 @@
<a class="sourceLine" id="cb6-13" data-line-number="13"></a>
<a class="sourceLine" id="cb6-14" data-line-number="14"><span class="kw"><a href="https://rdrr.io/r/base/summary.html">summary</a></span>(out2)</a>
<a class="sourceLine" id="cb6-15" data-line-number="15"><span class="co">#&gt; MCMC summary:</span></a>
<a class="sourceLine" id="cb6-16" data-line-number="16"><span class="co">#&gt; Number of Burn in steps: 0</span></a>
<a class="sourceLine" id="cb6-16" data-line-number="16"><span class="co">#&gt; Number of burn-in steps: 0</span></a>
<a class="sourceLine" id="cb6-17" data-line-number="17"><span class="co">#&gt; Number of MCMC steps: 1500</span></a>
<a class="sourceLine" id="cb6-18" data-line-number="18"><span class="co">#&gt; Thinning: 0</span></a>
<a class="sourceLine" id="cb6-19" data-line-number="19"><span class="co">#&gt; </span></a>
......@@ -327,17 +327,21 @@
<a class="sourceLine" id="cb9-28" data-line-number="28">nb.dag &lt;-<span class="st"> </span><span class="dv">10</span></a>
<a class="sourceLine" id="cb9-29" data-line-number="29">scores.dags &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/vector.html">vector</a></span>(<span class="dt">length =</span> nb.dag)</a>
<a class="sourceLine" id="cb9-30" data-line-number="30">num.arcs &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/vector.html">vector</a></span>(<span class="dt">length =</span> nb.dag)</a>
<a class="sourceLine" id="cb9-31" data-line-number="31"><span class="cf">for</span>(i <span class="cf">in</span> <span class="dv">1</span><span class="op">:</span>nb.dag){</a>
<a class="sourceLine" id="cb9-31" data-line-number="31">shd &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/vector.html">vector</a></span>(<span class="dt">length =</span> nb.dag)</a>
<a class="sourceLine" id="cb9-32" data-line-number="32"></a>
<a class="sourceLine" id="cb9-33" data-line-number="33"> dag &lt;-<span class="st"> </span>u.list.dag[,,<span class="kw"><a href="https://rdrr.io/r/base/order.html">order</a></span>(tab,<span class="dt">decreasing =</span> <span class="ot">TRUE</span>)[i]]</a>
<a class="sourceLine" id="cb9-34" data-line-number="34"> <span class="kw"><a href="https://rdrr.io/r/base/colnames.html">colnames</a></span>(dag) &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/colnames.html">rownames</a></span>(dag) &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/names.html">names</a></span>(dist.asia)</a>
<a class="sourceLine" id="cb9-35" data-line-number="35"> fabn &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/abn/man/fitabn.html">fitabn</a></span>(<span class="dt">dag.m =</span> (dag),<span class="dt">data.df =</span> asia,<span class="dt">data.dists =</span> dist.asia,<span class="dt">method =</span> <span class="st">"bayes"</span>)</a>
<a class="sourceLine" id="cb9-36" data-line-number="36"> scores.dags[i] &lt;-<span class="st"> </span>fabn<span class="op">$</span>mlik</a>
<a class="sourceLine" id="cb9-37" data-line-number="37"> num.arcs[i] &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/sum.html">sum</a></span>(dag)</a>
<a class="sourceLine" id="cb9-38" data-line-number="38">}</a></code></pre></div>
<a class="sourceLine" id="cb9-33" data-line-number="33"><span class="cf">for</span>(i <span class="cf">in</span> <span class="dv">1</span><span class="op">:</span>nb.dag){</a>
<a class="sourceLine" id="cb9-34" data-line-number="34"></a>
<a class="sourceLine" id="cb9-35" data-line-number="35"> dag &lt;-<span class="st"> </span>u.list.dag[,,<span class="kw"><a href="https://rdrr.io/r/base/order.html">order</a></span>(tab,<span class="dt">decreasing =</span> <span class="ot">TRUE</span>)[i]]</a>
<a class="sourceLine" id="cb9-36" data-line-number="36"> <span class="kw"><a href="https://rdrr.io/r/base/colnames.html">colnames</a></span>(dag) &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/colnames.html">rownames</a></span>(dag) &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/names.html">names</a></span>(dist.asia)</a>
<a class="sourceLine" id="cb9-37" data-line-number="37"> fabn &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/abn/man/fitabn.html">fitabn</a></span>(<span class="dt">dag.m =</span> (dag),<span class="dt">data.df =</span> asia,<span class="dt">data.dists =</span> dist.asia,<span class="dt">method =</span> <span class="st">"bayes"</span>)</a>
<a class="sourceLine" id="cb9-38" data-line-number="38"> scores.dags[i] &lt;-<span class="st"> </span>fabn<span class="op">$</span>mlik</a>
<a class="sourceLine" id="cb9-39" data-line-number="39"> num.arcs[i] &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/sum.html">sum</a></span>(dag)</a>
<a class="sourceLine" id="cb9-40" data-line-number="40"> shd[i] &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/abn/man/compareDag.html">compareDag</a></span>(<span class="dt">ref =</span> u.list.dag[,,<span class="kw"><a href="https://rdrr.io/r/base/order.html">order</a></span>(tab,<span class="dt">decreasing =</span> <span class="ot">TRUE</span>)[<span class="dv">1</span>]],u.list.dag[,,<span class="kw"><a href="https://rdrr.io/r/base/order.html">order</a></span>(tab,<span class="dt">decreasing =</span> <span class="ot">TRUE</span>)[i]])<span class="op">$</span><span class="st">`</span><span class="dt">Hamming-distance</span><span class="st">`</span></a>
<a class="sourceLine" id="cb9-41" data-line-number="41">}</a></code></pre></div>
<p>Let us plot the MCMC run</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/graphics/plot.html">plot</a></span>(out)</a></code></pre></div>
<p><img src="mcmcabn-advanced_files/figure-html/unnamed-chunk-10-1.png" width="672" style="display: block; margin: auto;"> Let us plot the diversity plot, where the x-axis is the number of arcs of each structure, the y1-axis is the occurence of the structures and the y2-axis is the scores. As one can see, half of the posterior distribution is represented by one DAG.</p>
<p><img src="mcmcabn-advanced_files/figure-html/unnamed-chunk-10-1.png" width="672" style="display: block; margin: auto;"></p>
<p>Let us plot the diversity plot, where the x1-axis is the number of arcs of each structure, the x2-axis is the structural Hamming distance (a proxy for how different two DAGs are), the y1-axis is the occurence of the structures and the y2-axis is the scores. As one can see, half of the posterior distribution is represented by one DAG.</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb11-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/graphics/plot.html">plot</a></span>(<span class="dv">1</span><span class="op">:</span>nb.dag, <span class="kw"><a href="https://rdrr.io/r/base/sort.html">sort</a></span>(tab,<span class="dt">decreasing =</span> <span class="ot">TRUE</span>)[<span class="dv">1</span><span class="op">:</span>nb.dag], <span class="dt">type =</span> <span class="st">'n'</span>,<span class="dt">ylab =</span> <span class="st">""</span>,<span class="dt">xlab =</span> <span class="st">"Number of arcs"</span>,<span class="dt">xaxt=</span><span class="st">"n"</span>,<span class="dt">yaxt=</span><span class="st">"n"</span>, <span class="dt">ylim =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="dv">0</span>,<span class="dv">2000</span>))</a>
<a class="sourceLine" id="cb11-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/r/graphics/axis.html">axis</a></span>(<span class="dv">2</span>,<span class="dt">at =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="dv">0</span>, <span class="dv">1000</span>, <span class="dv">2000</span>),<span class="dt">labels =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"0.0%"</span>,<span class="st">"50%"</span>,<span class="st">"100%"</span>),<span class="dt">col.axis =</span> <span class="st">"#4393C3"</span>)</a>
<a class="sourceLine" id="cb11-3" data-line-number="3"><span class="kw"><a href="https://rdrr.io/r/graphics/mtext.html">mtext</a></span>(<span class="st">"Occurence of DAGs"</span>, <span class="dt">side=</span><span class="dv">2</span>, <span class="dt">line=</span><span class="dv">2</span>, <span class="dt">col=</span><span class="st">"#4393C3"</span>)</a>
......@@ -346,7 +350,9 @@
<a class="sourceLine" id="cb11-6" data-line-number="6"><span class="kw"><a href="https://rdrr.io/r/graphics/plot.html">plot</a></span>(<span class="dt">x =</span> <span class="dv">1</span><span class="op">:</span>nb.dag,<span class="dt">y =</span> scores.dags,<span class="dt">col=</span><span class="st">"red"</span>, <span class="dt">type =</span> <span class="st">'b'</span>, <span class="dt">lwd=</span><span class="dv">2</span>, <span class="dt">axes =</span> <span class="ot">FALSE</span>, <span class="dt">xlab =</span> <span class="st">""</span>,<span class="dt">ylab=</span><span class="st">""</span>)</a>
<a class="sourceLine" id="cb11-7" data-line-number="7"><span class="kw"><a href="https://rdrr.io/r/graphics/axis.html">axis</a></span>(<span class="dv">4</span>, <span class="dt">col.axis =</span> <span class="st">'red'</span>)</a>
<a class="sourceLine" id="cb11-8" data-line-number="8"><span class="kw"><a href="https://rdrr.io/r/graphics/mtext.html">mtext</a></span>(<span class="st">"DAGs scores"</span>, <span class="dt">side=</span><span class="dv">4</span>, <span class="dt">line=</span><span class="fl">1.5</span>, <span class="dt">col=</span><span class="st">"red"</span>)</a>
<a class="sourceLine" id="cb11-9" data-line-number="9"><span class="kw"><a href="https://rdrr.io/r/graphics/axis.html">axis</a></span>(<span class="dv">1</span>, <span class="dt">col.axis =</span> <span class="st">'black'</span>,<span class="dt">at =</span> <span class="dv">1</span><span class="op">:</span>nb.dag,<span class="dt">labels =</span> num.arcs)</a></code></pre></div>
<a class="sourceLine" id="cb11-9" data-line-number="9"><span class="kw"><a href="https://rdrr.io/r/graphics/axis.html">axis</a></span>(<span class="dv">1</span>, <span class="dt">col.axis =</span> <span class="st">'black'</span>,<span class="dt">at =</span> <span class="dv">1</span><span class="op">:</span>nb.dag,<span class="dt">labels =</span> num.arcs)</a>
<a class="sourceLine" id="cb11-10" data-line-number="10"><span class="kw"><a href="https://rdrr.io/r/graphics/axis.html">axis</a></span>(<span class="dv">3</span>, <span class="dt">col.axis =</span> <span class="st">'orange'</span>,<span class="dt">at =</span> <span class="dv">1</span><span class="op">:</span>nb.dag,<span class="dt">labels =</span> shd)</a>
<a class="sourceLine" id="cb11-11" data-line-number="11"><span class="kw"><a href="https://rdrr.io/r/graphics/mtext.html">mtext</a></span>(<span class="st">"Structural Hamming distances"</span>, <span class="dt">side=</span><span class="dv">3</span>, <span class="dt">line=</span><span class="dv">2</span>, <span class="dt">col=</span><span class="st">"orange"</span>)</a></code></pre></div>
<p><img src="mcmcabn-advanced_files/figure-html/unnamed-chunk-11-1.png" width="672" style="display: block; margin: auto;"></p>
</div>
</div>
......
......@@ -233,7 +233,7 @@
<p>One can also print the summary of the MCMC run:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/summary.html">summary</a></span>(mcmc.out.asia)</a>
<a class="sourceLine" id="cb9-2" data-line-number="2"><span class="co">#&gt; MCMC summary:</span></a>
<a class="sourceLine" id="cb9-3" data-line-number="3"><span class="co">#&gt; Number of Burn in steps: 1000</span></a>
<a class="sourceLine" id="cb9-3" data-line-number="3"><span class="co">#&gt; Number of burn-in steps: 1000</span></a>
<a class="sourceLine" id="cb9-4" data-line-number="4"><span class="co">#&gt; Number of MCMC steps: 1e+05</span></a>
<a class="sourceLine" id="cb9-5" data-line-number="5"><span class="co">#&gt; Thinning: 99</span></a>
<a class="sourceLine" id="cb9-6" data-line-number="6"><span class="co">#&gt; </span></a>
......
......@@ -100,48 +100,27 @@
</header><div class="row">
<div class="contents col-md-9">
<hr>
<div id="mcmcabn-a-structural-mcmc-sampler-for-dags-learned-from-observed-systemic-datasets" class="section level1">
<div id="mcmcabn-an-r-package-for-sampling-dags-using-structural-mcmc" class="section level1">
<div class="page-header"><h1 class="hasAnchor">
<a href="#mcmcabn-a-structural-mcmc-sampler-for-dags-learned-from-observed-systemic-datasets" class="anchor"></a>mcmcabn: a structural MCMC sampler for DAGs learned from observed systemic datasets</h1></div>
<div id="quick-start" class="section level2">
<a href="#mcmcabn-an-r-package-for-sampling-dags-using-structural-mcmc" class="anchor"></a>mcmcabn: An R Package for sampling DAGs using structural MCMC</h1></div>
<p>(PUBLIC) !!! UNSTABLE VERSION !!!</p>
<p>mcmcabn is a one-man-show (me!) and made of more than 10’000 lines of code which are not bug free! So use it with caution and awareness.</p>
<div id="installation" class="section level2">
<h2 class="hasAnchor">
<a href="#quick-start" class="anchor"></a>Quick start</h2>
<p>To install <code>mcmabn</code> you need two R packages: <a href="https://CRAN.R-project.org/package=abn">abn</a> and <a href="https://CRAN.R-project.org/package=gRbase">gRbase</a> which requires libraries not stored on <a href="https://cran.r-project.org/">CRAN</a> but on <a href="http://www.bioconductor.org/">bioconductor</a>. Hence you <strong>must</strong> install these packages <strong>before</strong> installing <code>mcmcabn</code>:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="cf">if</span> (<span class="op">!</span><span class="kw"><a href="https://rdrr.io/r/base/ns-load.html">requireNamespace</a></span>(<span class="st">"BiocManager"</span>, <span class="dt">quietly =</span> <span class="ot">TRUE</span>))</a>
<a class="sourceLine" id="cb1-2" data-line-number="2"> <span class="kw"><a href="https://rdrr.io/r/utils/install.packages.html">install.packages</a></span>(<span class="st">"BiocManager"</span>)</a>
<a class="sourceLine" id="cb1-3" data-line-number="3">BiocManager<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/BiocManager/man/install.html">install</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"RBGL"</span>,<span class="st">"Rgraphviz"</span>,<span class="st">"graph"</span>), <span class="dt">version =</span> <span class="st">"3.8"</span>)</a>
<a class="sourceLine" id="cb1-4" data-line-number="4"></a>
<a class="sourceLine" id="cb1-5" data-line-number="5"><span class="kw"><a href="https://rdrr.io/r/utils/install.packages.html">install.packages</a></span>(<span class="st">"mcmcabn"</span>, <span class="dt">dependencies =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p>The three main problems addressed by this R package are:</p>
<ul>
<li>selecting the most probable structure based on a cache of pre-computed scores.</li>
<li>controlling for overfitting.</li>
<li>sampling the landscape of high scoring structures.</li>
</ul>
<p>The latter could be very useful in an applied perspective to avoid reducing the richeness of Bayesian network modelling to report only <strong>one</strong> structure. Indeed, it allows user to quantify the marginal impact of relationships of interest by marginalising out over structures or nuisance dependencies. Structural MCMC seems a very elegant and natural way to estimate the true marginal impact, so one can determine if it’s magnitude is big enough to consider as a worthwhile intervention.</p>
<a href="#installation" class="anchor"></a>Installation</h2>
<p><code><a href="https://rdrr.io/r/utils/install.packages.html">install.packages("https://git.math.uzh.ch/gkratz/mcmcabn/raw/master/mcmcabn_0.3.tar.gz", repo=NULL, type="source")</a></code></p>
<p>CRAN: <a href="https://CRAN.R-project.org/package=mcmcabn" class="uri">https://CRAN.R-project.org/package=mcmcabn</a> Website: <a href="https://www.math.uzh.ch/pages/mcmcabn/" class="uri">https://www.math.uzh.ch/pages/mcmcabn/</a></p>
</div>
<div id="description" class="section level2">
<h2 class="hasAnchor">
<a href="#description" class="anchor"></a>Description</h2>
<p>mcmcabn is a flexible implementation of a structural MCMC sampler for Directed Acyclic Graphs (DAGs). It supports the new edge reversal move from Grzegorczyk and Husmeier (2008) <a href="https://doi.org/10.1007/s10994-008-5057-7" class="uri">https://doi.org/10.1007/s10994-008-5057-7</a> and the Markov blanket resampling from Su and Borsuk (2016) <a href="http://jmlr.org/papers/v17/su16a.html" class="uri">http://jmlr.org/papers/v17/su16a.html</a>. It supports three priors: a prior controlling for structure complexity from Koivisto and Sood (2004) <a href="http://dl.acm.org/citation.cfm?id=1005332.1005352" class="uri">http://dl.acm.org/citation.cfm?id=1005332.1005352</a>, an uninformative prior and a user defined prior. The three main problems that can be addressed by this R package are selecting the most probable structure based on a cache of pre-computed scores, controlling for overfitting and sampling the landscape of high scoring structures. It allows to quantify the marginal impact of relationships of interest by marginalising out over structures or nuisance dependencies. Structural MCMC seems a very elegant and natural way to estimate the true marginal impact, so one can determine if it’s magnitude is big enough to consider as a worthwhile intervention.</p>
<hr>
<p>The package provides a flexible implementation of a structural MCMC sampler for Directed Acyclic Graphs (DAGs). It supports the new edge reversal move from Grzegorczyk and Husmeier (2008) <a href="https://doi.org/10.1007/s10994-008-5057-7" class="uri">https://doi.org/10.1007/s10994-008-5057-7</a> and the Markov blanket resampling from Su and Borsuk (2016) <a href="http://jmlr.org/papers/v17/su16a.html" class="uri">http://jmlr.org/papers/v17/su16a.html</a>. It supports three priors: a prior controlling for structure complexity from Koivisto and Sood (2004) <a href="http://dl.acm.org/citation.cfm?id=1005332.1005352" class="uri">http://dl.acm.org/citation.cfm?id=1005332.1005352</a>, an uninformative prior and a user defined prior. The three main problems that can be addressed by this R package are selecting the most probable structure based on a cache of pre-computed scores, controlling for overfitting and sampling the landscape of high scoring structures. It allows to quantify the marginal impact of relationships of interest by marginalising out over structures or nuisance dependencies. Structural MCMC seems a very elegant and natural way to estimate the true marginal impact, so one can determine if it’s magnitude is big enough to consider as a worthwhile intervention.</p>
</div>
<div id="whats-new" class="section level2">
<div id="future-implementations-ordered-by-urgency" class="section level2">
<h2 class="hasAnchor">
<a href="#whats-new" class="anchor"></a>What’s New</h2>
<ul>
<li><p>08/03/2019 - mcmcabn is available on CRAN (v 0.1)</p></li>
<li><p>18/02/2019 - new pre-print <a href="https://arxiv.org/pdf/1902.06641.pdf">Is a single unique Bayesian network enough to accurately represent your data?</a> on arXiv</p></li>
<li><p>01/07/2019 - mcmcabn 0.2 available on CRAN</p></li>
</ul>
<hr>
<p><strong><code>mcmcabn</code> is developed and maintained by <a href="https://gilleskratzer.netlify.com/">Gilles Kratzer</a> and <a href="https://user.math.uzh.ch/furrer/">Prof. Dr. Reinhard Furrer</a> from <a href="https://www.math.uzh.ch/as/index.php?id=as">Applied Statistics Group</a> from the University of Zurich.</strong></p>
<a href="#future-implementations-ordered-by-urgency" class="anchor"></a>Future implementations (ordered by urgency)</h2>
</div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
......@@ -175,16 +154,7 @@
</ul>
</div>
<div class="dev-status">
<h2>Dev status</h2>
<ul class="list-unstyled">
<li><a href="http://cran.rstudio.com/web/packages/mcmcabn/index.html"><img src="https://www.r-pkg.org/badges/version-ago/mcmcabn"></a></li>
<li><a href="http://cran.rstudio.com/web/packages/mcmcabn/index.html"><img src="http://cranlogs.r-pkg.org/badges/grand-total/mcmcabn" alt="Downloads"></a></li>
<li><a href="http://cran.rstudio.com/web/packages/mcmcabn/index.html"><img src="http://cranlogs.r-pkg.org/badges/mcmcabn" alt="Downloads"></a></li>
<li><a href="http://www.gnu.org/licenses/gpl-3.0"><img src="https://img.shields.io/badge/License-GPL%20v3-blue.svg" alt="License: GPL v3"></a></li>
</ul>
</div>
</div>
</div>
</div>
......
......@@ -160,6 +160,7 @@
<a href="#mcmcabn-0-3" class="anchor"></a>mcmcabn 0.3:</h2>
<ul>
<li>update mcmcabn to make it compatible with constraints imported from the cache of scores. Heating parameter to increase or decrease acceptance probability.</li>
<li>new article</li>
</ul>
</div>
</div>
......
......@@ -159,14 +159,14 @@
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='co'>## This data set was generated using the following code:</span>
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>bnlearn</span>) <span class='co'>#for the dataset</span></div><div class='output co'>#&gt; <span class='message'></span>
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='st'>"bnlearn"</span>) <span class='co'># for the dataset</span></div><div class='output co'>#&gt; <span class='message'></span>
#&gt; <span class='message'>Attaching package: ‘bnlearn’</span></div><div class='output co'>#&gt; <span class='message'>The following object is masked from ‘package:stats’:</span>
#&gt; <span class='message'></span>
#&gt; <span class='message'> sigma</span></div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>abn</span>) <span class='co'>#for the cache of score function</span></div><div class='output co'>#&gt; <span class='message'>Loading required package: nnet</span></div><div class='output co'>#&gt; <span class='message'>Loading required package: MASS</span></div><div class='output co'>#&gt; <span class='message'>Loading required package: lme4</span></div><div class='output co'>#&gt; <span class='message'>Loading required package: Matrix</span></div><div class='output co'>#&gt; <span class='message'></span>
#&gt; <span class='message'> sigma</span></div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='st'>"abn"</span>) <span class='co'># for the cache of score function</span></div><div class='output co'>#&gt; <span class='message'>Loading required package: nnet</span></div><div class='output co'>#&gt; <span class='message'>Loading required package: MASS</span></div><div class='output co'>#&gt; <span class='message'>Loading required package: lme4</span></div><div class='output co'>#&gt; <span class='message'>Loading required package: Matrix</span></div><div class='output co'>#&gt; <span class='message'></span>
#&gt; <span class='message'>Attaching package: ‘abn’</span></div><div class='output co'>#&gt; <span class='message'>The following object is masked from ‘package:bnlearn’:</span>
#&gt; <span class='message'></span>
#&gt; <span class='message'> mb</span></div><div class='input'>
<span class='co'>#renaming columns of the dataset</span>
<span class='co'># Renaming columns of the dataset</span>
<span class='fu'><a href='https://rdrr.io/r/base/colnames.html'>colnames</a></span>(<span class='no'>asia</span>) <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"Asia"</span>,
<span class='st'>"Smoking"</span>,
<span class='st'>"Tuberculosis"</span>,
......@@ -176,16 +176,6 @@
<span class='st'>"XRay"</span>,
<span class='st'>"Dyspnea"</span>)
<span class='co'>#lets define the distribution list</span>
<span class='no'>dist.asia</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span>(<span class='kw'>Asia</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>Smoking</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>Tuberculosis</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>LungCancer</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>Bronchitis</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>Either</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>XRay</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>Dyspnea</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>)
<span class='no'>bsc.compute.asia</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/abn/man/build_score_cache.html'>buildscorecache</a></span>(<span class='kw'>data.df</span> <span class='kw'>=</span> <span class='no'>asia</span>,
<span class='kw'>data.dists</span> <span class='kw'>=</span> <span class='no'>dist.asia</span>,
<span class='kw'>max.parents</span> <span class='kw'>=</span> <span class='fl'>2</span>)</div></pre>
......
......@@ -159,9 +159,9 @@
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='co'>## This data set was generated using the following code:</span>
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>bnlearn</span>) <span class='co'>#for the dataset</span>
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='st'>"bnlearn"</span>) <span class='co'># for the dataset</span>
<span class='co'>#renaming columns of the dataset</span>
<span class='co'># Renaming columns of the dataset</span>
<span class='fu'><a href='https://rdrr.io/r/base/colnames.html'>colnames</a></span>(<span class='no'>asia</span>) <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"Asia"</span>,
<span class='st'>"Smoking"</span>,
<span class='st'>"Tuberculosis"</span>,
......@@ -171,7 +171,7 @@
<span class='st'>"XRay"</span>,
<span class='st'>"Dyspnea"</span>)
<span class='co'>#lets define the distribution list</span>
<span class='co'># Defining the distribution list</span>
<span class='no'>dist.asia</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span>(<span class='kw'>Asia</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>Smoking</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>Tuberculosis</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
......
......@@ -193,6 +193,12 @@
<td><p>Function to plot mcmcabn class objects</p></td>
</tr><tr>
<td>
<p><code><a href="print-summary.html">print(<i>&lt;summary.mcmcabn&gt;</i>)</a></code> </p>
</td>
<td><p>Methods for printing the summary of mcmcabn objects</p></td>
</tr><tr>
<td>
<p><code><a href="print.html">print(<i>&lt;mcmcabn&gt;</i>)</a></code> </p>
</td>
......
......@@ -163,30 +163,6 @@
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>bnlearn</span>) <span class='co'>#for the dataset</span>
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>abn</span>) <span class='co'>#for the cache of scores computing function</span>
<span class='co'>#renaming columns of the dataset</span>
<span class='fu'><a href='https://rdrr.io/r/base/colnames.html'>colnames</a></span>(<span class='no'>asia</span>) <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"Asia"</span>,
<span class='st'>"Smoking"</span>,
<span class='st'>"Tuberculosis"</span>,
<span class='st'>"LungCancer"</span>,
<span class='st'>"Bronchitis"</span>,
<span class='st'>"Either"</span>,
<span class='st'>"XRay"</span>,
<span class='st'>"Dyspnea"</span>)
<span class='co'>#lets define the distribution list</span>
<span class='no'>dist.asia</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span>(<span class='kw'>Asia</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>Smoking</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>Tuberculosis</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>LungCancer</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>Bronchitis</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>Either</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>XRay</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>,
<span class='kw'>Dyspnea</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>)
<span class='no'>bsc.compute.asia</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/abn/man/build_score_cache.html'>buildscorecache</a></span>(<span class='kw'>data.df</span> <span class='kw'>=</span> <span class='no'>asia</span>,
<span class='kw'>data.dists</span> <span class='kw'>=</span> <span class='no'>dist.asia</span>,
<span class='kw'>max.parents</span> <span class='kw'>=</span> <span class='fl'>2</span>)
<span class='no'>mcmc.out.asia</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='mcmc.html'>mcmcabn</a></span>(<span class='kw'>score.cache</span> <span class='kw'>=</span> <span class='no'>bsc.compute.asia</span>,
<span class='kw'>score</span> <span class='kw'>=</span> <span class='st'>"mlik"</span>,
<span class='kw'>data.dists</span> <span class='kw'>=</span> <span class='no'>dist.asia</span>,
......
......@@ -228,10 +228,10 @@
<p>The procedure runs a structural Monte Carlo Markov Chain Model Choice (MC)^3 to find the most probable posterior network (DAG). The default algorithm is based on three MCMC move: edge addition, edge deletion and edge reversal. This algorithm is known as the (MC)^3. It is known to mix slowly and getting stuck in low probability regions. Indeed, changing of Markov equivalence region often requires multiple MCMC moves. Then large scale MCMC moves are implemented. Their relative frequency can be set by the user. The new edge reversal move (REV) from Grzegorczyk and Husmeier (2008) and the Markov blanket resampling (MBR) from Su and Borsuk (2016). The classical reversal move depends on the global configuration of the parents and children and fails to propose MCMC jumps that produce valid but very different DAGs in a unique move. The REV move sample globally a new set of parent. The MBR workaround applies the same idea but to the entire Markov blanket of a randomly chosen node.</p>
<p>The classical (MC)^3 is unbiased but inefficient in mixing, the two radical MCMC alternative move are known to massively accelerate mixing without introducing biases. But those move are computationally expensive. Then low frequencies are advised. The REV move is not necessarily ergotic , then it should not be used alone.</p>
<p>The parameter <code>start.dag</code> can be: "random", "hc" or user defined. If user select "random" then a random valid DAG is selected. The routine used favourise low density structure. If "hc" (for Hill-climber: searchHeuristic then a DAG is selected using 100 different searches with 500 optimization steps. A user defined DAG can be provided. It should be a named square matrix containing only zeros and ones. The DAG should be valid (i.e. acyclic).</p>
<p>The parameter <code>prior.choice</code> determines the prior used within each individual node for a given choice of parent combination. In Koivisto and Sood (2004) p.554 a form of prior is used which assumes that the prior probability for parent combinations comprising of the same number of parents are all equal. Specifically, that the prior probability for parent set G with cardinality |G| is proportional to 1/[n-1 choose |G|] where there are n total nodes. Note that this favours parent combinations with either very low or very high cardinality which may not be appropriate. This prior is used when <code>prior.choice=2</code>. When prior.choice=1 an uninformative prior is used where parent combinations of all cardinalities are equally likely. When <code>prior.choice=3</code> a user defined prior is used, defined by <code>prior.dag</code>. It is given by an adjacency matrix (squared and same size as number of nodes) where entries ranging from zero to one give the user prior belief. An hyper parameter defining the global user belief in the prior is given by <code>prior.lambda</code>.</p>
<p>MCMC sampler came with asymptotic statistical guarantees. Therefore it is highly advised to run multiple long enough chains. The burn in phase length (i.e throwing away first MCMC iterations) should be adequately chosen.</p>
<p>The argument <code>data.dists</code> must be a list with named arguments, one for each of the variables in <code>data.df</code>, where each entry is either "poisson","binomial", or "gaussian".</p>
<p>The parameter <code>start.dag</code> can be: <code>"random"</code>, <code>"hc"</code> or user defined. If user select <code>"random"</code> then a random valid DAG is selected. The routine used favourise low density structure. If <code>"hc"</code> (for Hill-climber: searchHeuristic then a DAG is selected using 100 different searches with 500 optimization steps. A user defined DAG can be provided. It should be a named square matrix containing only zeros and ones. The DAG should be valid (i.e. acyclic).</p>
<p>The parameter <code>prior.choice</code> determines the prior used within each individual node for a given choice of parent combination. In Koivisto and Sood (2004) p.554 a form of prior is used which assumes that the prior probability for parent combinations comprising of the same number of parents are all equal. Specifically, that the prior probability for parent set G with cardinality |G| is proportional to 1/[n-1 choose |G|] where there are n total nodes. Note that this favours parent combinations with either very low or very high cardinality which may not be appropriate. This prior is used when <code>prior.choice=2</code>. When <code>prior.choice=1</code> an uninformative prior is used where parent combinations of all cardinalities are equally likely. When <code>prior.choice=3</code> a user defined prior is used, defined by <code>prior.dag</code>. It is given by an adjacency matrix (squared and same size as number of nodes) where entries ranging from zero to one give the user prior belief. An hyper parameter defining the global user belief in the prior is given by <code>prior.lambda</code>.</p>
<p>MCMC sampler come with asymptotic statistical guarantees. Therefore it is highly advised to run multiple long enough chains. The burn in phase length (i.e throwing away first MCMC iterations) should be adequately chosen.</p>
<p>The argument <code>data.dists</code> must be a list with named arguments, one for each of the variables in <code>data.df</code>, where each entry is either <code>"poisson"</code>, <code>"binomial"</code>, or <code>"gaussian"</code>.</p>
<p>The parameter <code>heating</code> could improve convergence. It should be a real positive number. If smaller than one it is a tuning parameter which transforms the score by raising it to this power. One is neutral. The smaller the more probable to accept any move. If larger than one, it indicates the number of returned steps where an exponentially decrease heating scheme is applied. After this number of steps, the <code>heating</code> parameter is set to one.</p>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
......@@ -239,30 +239,31 @@
<h2 class="hasAnchor" id="references"><a class="anchor" href="#references"></a>References</h2>
<p>For the implementation of the function:</p>
<p>Kratzer, G. Furrer, R. "Is a single unique Bayesian network enough to accurately represent your data?". arXiv preprint arXiv:1902.06641.</p>
<p>Kratzer, G., Furrer, R. "Is a single unique Bayesian network enough to accurately represent your data?". arXiv preprint arXiv:1902.06641.</p>
<p>For the new edge reversal:</p>
<p>Grzegorczyk, M.Husmeier, D. "Improving the structure MCMC sampler for Bayesian networks by introducing a new edge reversal move", Machine Learning, vol. 71(2-3), pp. 265, 2008.</p>
<p>Grzegorczyk, M., Husmeier, D. (2008). "Improving the structure MCMC sampler for Bayesian networks by introducing a new edge reversal move", Machine Learning, vol. 71(2-3), 265.</p>
<p>For the Markov Blanket resampling move:</p>
<p>Su, C.Borsuk, M. E. "Improving structure MCMC for Bayesian networks through Markov blanket resampling", The Journal of Machine Learning Research, vol. 17(1), pp. 4042-4061, 2016.</p>
<p>Su, C., Borsuk, M. E. (2016). "Improving structure MCMC for Bayesian networks through Markov blanket resampling", The Journal of Machine Learning Research, vol. 17(1), 4042-4061.</p>
<p>For the Koivisto prior:</p>
<p>Koivisto, M. V. (2004). Exact Structure Discovery in Bayesian Networks, Journal of Machine Learning Research, vol 5, 549-573.</p>
<p>For the user defined prior:</p>
<p>Werhli, A. V., &amp; Husmeier, D. (2007). "Reconstructing gene regulatory networks with Bayesian networks by combining expression data with multiple sources of prior knowledge". Statistical Applications in Genetics and Molecular Biology, 6 (Article 15).</p>
<p>Imoto, S., Higuchi, T., Goto, T., Tashiro, K., Kuhara, S., &amp; Miyano, S. (2003). Using Bayesian networks for estimating gene networks from microarrays and biological knowledge. In Proceedings of the European Conference on Computational Biology.</p>
<p>Werhli, A. V., Husmeier, D. (2007). "Reconstructing gene regulatory networks with Bayesian networks by combining expression data with multiple sources of prior knowledge". Statistical Applications in Genetics and Molecular Biology, 6 (Article 15).</p>
<p>Imoto, S., Higuchi, T., Goto, T., Tashiro, K., Kuhara, S., Miyano, S. (2003). Using Bayesian networks for estimating gene networks from microarrays and biological knowledge. In Proceedings of the European Conference on Computational Biology.</p>
<p>For the asia dataset:</p>
<p>Scutari, M. (2010). Learning Bayesian Networks with the bnlearn R Package. Journal of Statistical Software, 35(3), 1 - 22. doi:http://dx.doi.org/10.18637/jss.v035.i03.</p>
<p>Scutari, M. (2010). Learning Bayesian Networks with the bnlearn R Package. Journal of Statistical Software, 35(3), 1-22. doi:http://dx.doi.org/10.18637/jss.v035.i03.</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='co'>## Example from the asia dataset from Lauritzen and Spiegelhalter (1988) provided by Scutari (2010)</span>
<pre class="examples"><div class='input'><span class='co'>## Example from the asia dataset from Lauritzen and Spiegelhalter (1988)</span>
<span class='co'>## provided by Scutari (2010)</span>
<span class='co'># the number of MCMC run is delibaretelly chosen too small (computing time)</span>
<span class='co'># The number of MCMC run is delibaretelly chosen too small (computing time)</span>
<span class='co'># no thinning (usually not recommended)</span>
<span class='co'># no burn-in (usually not recommended,</span>
<span class='co'># even if not supported by any theoretical arguments)</span>
<span class='fu'><a href='https://rdrr.io/r/utils/data.html'>data</a></span>(<span class='st'>"mcmc_run_asia"</span>)
<span class='co'># let us run: 0.03 REV, 0.03 MBR, 0.94 MC3 MCMC jumps</span>
<span class='co'># Let us run: 0.03 REV, 0.03 MBR, 0.94 MC3 MCMC jumps</span>
<span class='co'># with a random DAG as starting point</span>
<span class='no'>mcmc.out.asia.small</span> <span class='kw'>&lt;-</span> <span class='fu'>mcmcabn</span>(<span class='kw'>score.cache</span> <span class='kw'>=</span> <span class='no'>bsc.compute.asia</span>,
......@@ -278,7 +279,7 @@
<span class='kw'>prior.choice</span> <span class='kw'>=</span> <span class='fl'>2</span>)
<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span>(<span class='no'>mcmc.out.asia.small</span>)</div><div class='output co'>#&gt; MCMC summary:
#&gt; Number of Burn in steps: 0
#&gt; Number of burn-in steps: 0
#&gt; Number of MCMC steps: 100
#&gt; Thinning: 0
#&gt;
......@@ -319,7 +320,7 @@
<span class='kw'>prior.choice</span> <span class='kw'>=</span> <span class='fl'>2</span>)
<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span>(<span class='no'>mcmc.out.asia.small</span>)</div><div class='output co'>#&gt; MCMC summary:
#&gt; Number of Burn in steps: 0
#&gt; Number of burn-in steps: 0
#&gt; Number of MCMC steps: 100
#&gt; Thinning: 0
#&gt;
......@@ -343,7 +344,7 @@
#&gt; acf 1 0.9115666 0.8232014 0.7162509 0.6092764 0.5204256 0.4313169 0.3309841
#&gt; 8 9 10
#&gt; acf 0.2299462 0.1679331 0.105142</div><div class='input'>
<span class='co'>#let us define a starting DAG</span>
<span class='co'># Defining a starting DAG</span>
<span class='no'>startDag</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/matrix.html'>matrix</a></span>(<span class='kw'>data</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>0</span>, <span class='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>0</span>, <span class='fl'>0</span>, <span class='fl'>0</span>, <span class='fl'>0</span>,
<span class='fl'>0</span>, <span class='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>0</span>, <span class='fl'>0</span>, <span class='fl'>0</span>, <span class='fl'>0</span>, <span class='fl'>0</span>,
<span class='fl'>1</span>, <span class='fl'>0</span>, <span class='fl'>0</span>, <span class='fl'>0</span>, <span class='fl'>0</span>, <span class='fl'>0</span>, <span class='fl'>0</span>, <span class='fl'>0</span>,
......@@ -369,7 +370,7 @@
<span class='kw'>prior.choice</span> <span class='kw'>=</span> <span class='fl'>1</span>)
<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span>(<span class='no'>mcmc.out.asia.small</span>)</div><div class='output co'>#&gt; MCMC summary:
#&gt; Number of Burn in steps: 0
#&gt; Number of burn-in steps: 0
#&gt; Number of MCMC steps: 100
#&gt; Thinning: 0
#&gt;
......@@ -417,7 +418,7 @@
<span class='kw'>prior.dag</span> <span class='kw'>=</span> <span class='no'>priorDag</span>)
<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span>(<span class='no'>mcmc.out.asia.small</span>)</div><div class='output co'>#&gt; MCMC summary:
#&gt; Number of Burn in steps: 0
#&gt; Number of burn-in steps: 0
#&gt; Number of MCMC steps: 100
#&gt; Thinning: 0
#&gt;
......@@ -448,41 +449,41 @@
<span class='kw'>score</span> <span class='kw'>=</span> <span class='st'>"mlik"</span>,
<span class='kw'>data.dists</span> <span class='kw'>=</span> <span class='no'>dist.asia</span>,
<span class='kw'>max.parents</span> <span class='kw'>=</span> <span class='fl'>2</span>,
<span class='kw'>mcmc.scheme</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>100</span>,<span class='fl'>0</span>,<span class='fl'>0</span>),
<span class='kw'>seed</span> <span class='kw'>=</span> <span class='fl'>321</span>,
<span class='kw'>mcmc.scheme</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>150</span>,<span class='fl'>0</span>,<span class='fl'>0</span>),
<span class='kw'>seed</span> <span class='kw'>=</span> <span class='fl'>41242</span>,
<span class='kw'>verbose</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
<span class='kw'>start.dag</span> <span class='kw'>=</span> <span class='st'>"random"</span>,
<span class='kw'>prob.rev</span> <span class='kw'>=</span> <span class='fl'>0.03</span>,
<span class='kw'>prob.mbr</span> <span class='kw'>=</span> <span class='fl'>0.03</span>,
<span class='kw'>prior.choice</span> <span class='kw'>=</span> <span class='fl'>2</span>, <span class='kw'>heating</span> <span class='kw'>=</span> <span class='fl'>20</span>)
<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span>(<span class='no'>mcmc.out.asia.small</span>)</div><div class='output co'>#&gt; MCMC summary:
#&gt; Number of Burn in steps: 0
#&gt; Number of MCMC steps: 100
<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span>(<span class='no'>mcmc.out.asia.small</span>)</div><div class='output co'>#&gt; MCMC summary:
#&gt; Number of burn-in steps: 0
#&gt; Number of MCMC steps: 150
#&gt; Thinning: 0
#&gt;
#&gt; Maximum score: -12382.55
#&gt; Empirical mean: -13038.58
#&gt; Empirical standard deviation: 691.47
#&gt; Maximum score: -11158.05
#&gt; Empirical mean: -11743.41
#&gt; Empirical standard deviation: 1145.562
#&gt; Quantiles of the posterior network score:
#&gt; 0.025 0.25 0.5 0.75 0.975
#&gt; BN score -14150.79 -13826.07 -12644.32 -12387.14 -12382.55
#&gt; 0.025 0.25 0.5 0.75 0.975
#&gt; BN score -15122.56 -11795.9 -11278.11 -11165.74 -11158.05
#&gt;
#&gt;
#&gt; Global acceptance rate: 0.2277228
#&gt; Global acceptance rate: 0.2317881
#&gt; Accepted Rejected
#&gt; MBR 2 0
#&gt; MC3 21 77
#&gt; REV 0 1
#&gt; MBR 2 2
#&gt; MC3 32 111
#&gt; REV 1 3
#&gt;
#&gt;
#&gt; Sample size adjusted for autocorrelation: 1.311912
#&gt; Sample size adjusted for autocorrelation: 2.998704
#&gt;
#&gt; Autocorrelations by lag:
#&gt; 0 1 2 3 4 5 6 7
#&gt; acf 1 0.974099 0.948068 0.9219238 0.8957141 0.869547 0.8422681 0.8149795
#&gt; 0 1 2 3 4 5 6 7
#&gt; acf 1 0.9607992 0.9215685 0.8768169 0.83133 0.779314 0.7273621 0.6703544
#&gt; 8 9 10
#&gt; acf 0.787679 0.7594535 0.7336757</div><div class='input'>
#&gt; acf 0.612575 0.5547808 0.4964446</div><div class='input'>
</div></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
......
......@@ -182,15 +182,16 @@ H. Wickham. ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New Yor
<p>Alboukadel Kassambara (2018). ggpubr: 'ggplot2' Based Publication Ready Plots. R package version 0.2. https://CRAN.R-project.org/package=ggpubr</p>
<p>Claus O. Wilke (2019). cowplot: Streamlined Plot Theme and Plot Annotations for 'ggplot2'. R package version 0.9.4. https://CRAN.R-project.org/package=cowplot</p>
<p>Data:
Scutari, M. (2010). Learning Bayesian Networks with the bnlearn R Package. Journal of Statistical Software, 35(3), 1 - 22. doi:http://dx.doi.org/10.18637/jss.v035.i03.</p>
Scutari, M. (2010). Learning Bayesian Networks with the bnlearn R Package. Journal of Statistical Software, 35(3), 1-22. doi:http://dx.doi.org/10.18637/jss.v035.i03.</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='co'>## Example from the asia dataset from Lauritzen and Spiegelhalter (1988) provided by Scutari (2010)</span>
<pre class="examples"><div class='input'><span class='co'>## Example from the asia dataset from Lauritzen and Spiegelhalter (1988)</span>
<span class='co'>## provided by Scutari (2010)</span>
<span class='fu'><a href='https://rdrr.io/r/utils/data.html'>data</a></span>(<span class='st'>"mcmc_run_asia"</span>)
<span class='co'>#plot the mcmc run</span>
<span class='co'># plot the mcmc run</span>
<span class='fu'><a href='https://rdrr.io/r/graphics/plot.html'>plot</a></span>(<span class='no'>mcmc.out.asia</span>)</div><div class='img'><img src='plot-1.png' alt='' width='700' height='433' /></div><div class='input'>
<span class='co'>#plot cumulative max score</span>
<span class='co'># plot cumulative max score</span>
<span class='fu'><a href='https://rdrr.io/r/graphics/plot.html'>plot</a></span>(<span class='no'>mcmc.out.asia</span>, <span class='kw'>max.score</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='img'><img src='plot-2.png' alt='' width='700' height='433' /></div></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
......
<!-- Generated by pkgdown: do not edit by hand -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Methods for printing the summary of mcmcabn objects — print.summary.mcmcabn • mcmcabn</title>
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script>
<meta property="og:title" content="Methods for printing the summary of mcmcabn objects — print.summary.mcmcabn" />
<meta property="og:description" content="
Method for printing the summary of mcmcabn objects." />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container template-reference-topic">
<header>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mcmcabn</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home"></span>
</a>