Commit 32f41704 authored by Gilles Kratzer's avatar Gilles Kratzer
Browse files

update website

parent e6c8c47e
Pipeline #2072 passed with stage
in 2 seconds
No preview for this file type
This diff is collapsed.
......@@ -100,11 +100,11 @@
<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"><pre class="sourceCode r"><code class="sourceCode r"><span class="cf">if</span> (<span class="op">!</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/ns-load">requireNamespace</a></span>(<span class="st">"BiocManager"</span>, <span class="dt">quietly =</span> <span class="ot">TRUE</span>))
<span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/install.packages">install.packages</a></span>(<span class="st">"BiocManager"</span>)
BiocManager<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/BiocManager/topics/install">install</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">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>)
<span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/install.packages">install.packages</a></span>(<span class="st">"mcmcabn"</span>, <span class="dt">dependencies =</span> <span class="ot">TRUE</span>)</code></pre></div>
<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://www.rdocumentation.org/packages/base/topics/ns-load">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://www.rdocumentation.org/packages/utils/topics/install.packages">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://www.rdocumentation.org/packages/BiocManager/topics/install">install</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">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://www.rdocumentation.org/packages/utils/topics/install.packages">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>
......
pandoc: 1.19.2.1
pandoc: 2.3.1
pkgdown: 1.3.0
pkgdown_sha: ~
articles:
......
......@@ -148,7 +148,7 @@
#&gt; <span class='message'></span>
#&gt; <span class='message'> compare</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://www.rdocumentation.org/packages/base/topics/library'>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: Cairo</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='warning'>Warning: package ‘lme4’ was built under R version 3.5.2</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://www.rdocumentation.org/packages/base/topics/library'>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'>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'>
......
This diff is collapsed.
......@@ -256,35 +256,43 @@
<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'>prior.choice</span> <span class='kw'>=</span> <span class='fl'>2</span>)</div><div class='output co'>#&gt; [1] -12044.84
#&gt; [1] -12122.55
#&gt; [1] -12044.84
#&gt; [1] -11348.45
#&gt; [1] -11348.45
#&gt; [1] -11343.06
#&gt; [1] -11343.06
#&gt; [1] -11343.06
#&gt; [1] -11338.42
#&gt; [1] -12429.65</div><div class='input'>
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>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
#&gt; Thinning: 0
#&gt;
#&gt; Maximum score: -11370.47
#&gt; Empirical mean: -12614.7
#&gt; Empirical standard deviation: 1392.967
#&gt; Maximum score: -11252.53
#&gt; Empirical mean: -12577.33
#&gt; Empirical standard deviation: 1420.952
#&gt; Quantiles of the posterior network score:
#&gt; 0.025 0.25 0.5 0.75 0.975
#&gt; BN score -15127.73 -13458.25 -12044.84 -11371.57 -11370.47
#&gt; BN score -15127.73 -13458.25 -12044.84 -11338.42 -11254.25
#&gt;
#&gt;
#&gt; Global acceptance rate: 0.3168317
#&gt; Global acceptance rate: 0.3366337
#&gt; Accepted Rejected
#&gt; MBR 0 2
#&gt; MC3 30 67
#&gt; REV 2 0
#&gt; MBR 2 2
#&gt; MC3 32 63
#&gt; REV 0 2
#&gt;
#&gt;
#&gt; Sample size adjusted for autocorrelation: 1.406361
#&gt; Sample size adjusted for autocorrelation: 1.429643
#&gt;
#&gt; Autocorrelations by lag:
#&gt; 0 1 2 3 4 5 6 7
#&gt; acf 1 0.9722601 0.9437878 0.9152083 0.8843368 0.8535088 0.8225977 0.7915496
#&gt; 0 1 2 3 4 5 6 7
#&gt; acf 1 0.9718074 0.9436429 0.9153732 0.8849037 0.8544765 0.823888 0.7931788
#&gt; 8 9 10
#&gt; acf 0.7605535 0.7286543 0.6975366</div><div class='input'>
#&gt; acf 0.7625209 0.7275857 0.6933869</div><div class='input'>
<span class='co'># Uniquelly with MC3 moves</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>,
......
This diff is collapsed.
docs/reference/plot-1.png

217 KB | W: | H:

docs/reference/plot-1.png

145 KB | W: | H:

docs/reference/plot-1.png
docs/reference/plot-1.png
docs/reference/plot-1.png
docs/reference/plot-1.png
  • 2-up
  • Swipe
  • Onion skin
docs/reference/plot-2.png

81.5 KB | W: | H:

docs/reference/plot-2.png

76.8 KB | W: | H:

docs/reference/plot-2.png
docs/reference/plot-2.png
docs/reference/plot-2.png
docs/reference/plot-2.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -160,7 +160,7 @@ print(x, &#8230;)</pre>
<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>
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/print'>print</a></span>(<span class='no'>mcmc.out.asia</span>)</div><div class='output co'>#&gt; Posterior Bayesian network score estimated using MCMC:Number of Burn in steps: 10000
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/print'>print</a></span>(<span class='no'>mcmc.out.asia</span>)</div><div class='output co'>#&gt; Posterior Bayesian network score estimated using MCMC:Number of Burn in steps: 1000
#&gt; Number of MCMC steps: 1e+05
#&gt; Thinning: 99
#&gt; </div></pre>
......
......@@ -173,37 +173,37 @@ terms, `.` replaces all the variables in name. Additional, when one want to excl
<span class='fu'><a href='https://www.rdocumentation.org/packages/utils/topics/data'>data</a></span>(<span class='st'>"mcmc_run_asia"</span>)
<span class='co'>##return a named matrix with individual arc support</span>
<span class='fu'>query</span>(<span class='kw'>mcmcabn</span> <span class='kw'>=</span> <span class='no'>mcmc.out.asia</span>)</div><div class='output co'>#&gt; Asia Smoking Tuberculosis LungCancer Bronchitis
#&gt; Asia 0.00000000 0.04795205 0.10989011 0.06193806 0.05794206
#&gt; Smoking 0.01498501 0.00000000 0.05994006 0.28671329 0.31468531
#&gt; Tuberculosis 0.02797203 0.17782218 0.00000000 0.32967033 0.01398601
#&gt; LungCancer 0.01798202 0.40059940 0.16583417 0.00000000 0.06093906
#&gt; Bronchitis 0.01298701 0.51148851 0.01598402 0.07492507 0.00000000
#&gt; Either 0.01198801 0.27172827 0.31268731 0.35664336 0.07792208
#&gt; XRay 0.01498501 0.15784216 0.30469530 0.27972028 0.05294705
#&gt; Dyspnea 0.01198801 0.21878122 0.09290709 0.24375624 0.53546454
#&gt; Either XRay Dyspnea
#&gt; Asia 0.09290709 0.05094905 0.05994006
#&gt; Smoking 0.16283716 0.10789211 0.22477522
#&gt; Tuberculosis 0.43356643 0.20179820 0.11388611
#&gt; LungCancer 0.32067932 0.21178821 0.20279720
#&gt; Bronchitis 0.12287712 0.08491508 0.35364635
#&gt; Either 0.00000000 0.28271728 0.22577423
#&gt; XRay 0.44455544 0.00000000 0.10789211
#&gt; Dyspnea 0.35464535 0.15084915 0.00000000</div><div class='input'>
<span class='fu'>query</span>(<span class='kw'>mcmcabn</span> <span class='kw'>=</span> <span class='no'>mcmc.out.asia</span>)</div><div class='output co'>#&gt; Asia Smoking Tuberculosis LungCancer Bronchitis
#&gt; Asia 0.00000000 0.007992008 0.01698302 0.005994006 0.007992008
#&gt; Smoking 0.01498501 0.000000000 0.03296703 0.416583417 0.434565435
#&gt; Tuberculosis 0.02497502 0.031968032 0.00000000 0.099900100 0.006993007
#&gt; LungCancer 0.01298701 0.397602398 0.15784216 0.000000000 0.057942058
#&gt; Bronchitis 0.00999001 0.484515485 0.01898102 0.102897103 0.000000000
#&gt; Either 0.02097902 0.085914086 0.75224775 0.743256743 0.018981019
#&gt; XRay 0.00999001 0.023976024 0.34065934 0.288711289 0.005994006
#&gt; Dyspnea 0.01098901 0.096903097 0.18781219 0.295704296 0.671328671
#&gt; Either XRay Dyspnea
#&gt; Asia 0.007992008 0.008991009 0.005994006
#&gt; Smoking 0.099900100 0.032967033 0.065934066
#&gt; Tuberculosis 0.138861139 0.048951049 0.205794206
#&gt; LungCancer 0.196803197 0.057942058 0.132867133
#&gt; Bronchitis 0.088911089 0.046953047 0.283716284
#&gt; Either 0.000000000 0.108891109 0.049950050
#&gt; XRay 0.631368631 0.000000000 0.008991009
#&gt; Dyspnea 0.409590410 0.070929071 0.000000000</div><div class='input'>
<span class='co'>## what is the probability of LungCancer node being children of the Smoking node?</span>
<span class='fu'>query</span>(<span class='kw'>mcmcabn</span> <span class='kw'>=</span> <span class='no'>mcmc.out.asia</span>,<span class='kw'>formula</span> <span class='kw'>=</span> ~<span class='no'>LungCancer</span><span class='kw'>|</span><span class='no'>Smoking</span>)</div><div class='output co'>#&gt; [1] 0.4005994</div><div class='input'>
<span class='fu'>query</span>(<span class='kw'>mcmcabn</span> <span class='kw'>=</span> <span class='no'>mcmc.out.asia</span>,<span class='kw'>formula</span> <span class='kw'>=</span> ~<span class='no'>LungCancer</span><span class='kw'>|</span><span class='no'>Smoking</span>)</div><div class='output co'>#&gt; [1] 0.3976024</div><div class='input'>
<span class='co'>## what is the probability of Smoking node being parent of</span>
<span class='co'>## both LungCancer and Bronchitis node?</span>
<span class='fu'>query</span>(<span class='kw'>mcmcabn</span> <span class='kw'>=</span> <span class='no'>mcmc.out.asia</span>,
<span class='kw'>formula</span> <span class='kw'>=</span> ~ <span class='no'>LungCancer</span><span class='kw'>|</span><span class='no'>Smoking</span>+<span class='no'>Bronchitis</span><span class='kw'>|</span><span class='no'>Smoking</span>)</div><div class='output co'>#&gt; [1] 0.2037962</div><div class='input'>
<span class='kw'>formula</span> <span class='kw'>=</span> ~ <span class='no'>LungCancer</span><span class='kw'>|</span><span class='no'>Smoking</span>+<span class='no'>Bronchitis</span><span class='kw'>|</span><span class='no'>Smoking</span>)</div><div class='output co'>#&gt; [1] 0.1778222</div><div class='input'>
<span class='co'>## what is the probability of previous statement,</span>
<span class='co'>## when there is no arc from Smoking to Tuberculosis and from Bronchitis to XRay?</span>
<span class='fu'>query</span>(<span class='kw'>mcmcabn</span> <span class='kw'>=</span> <span class='no'>mcmc.out.asia</span>,
<span class='kw'>formula</span> <span class='kw'>=</span> ~<span class='no'>LungCancer</span><span class='kw'>|</span><span class='no'>Smoking</span> +
<span class='no'>Bronchitis</span><span class='kw'>|</span><span class='no'>Smoking</span> -
<span class='no'>Tuberculosis</span><span class='kw'>|</span><span class='no'>Smoking</span> -
<span class='no'>XRay</span><span class='kw'>|</span><span class='no'>Bronchitis</span>)</div><div class='output co'>#&gt; [1] 0.002997003</div></pre>
<span class='no'>XRay</span><span class='kw'>|</span><span class='no'>Bronchitis</span>)</div><div class='output co'>#&gt; [1] 0</div></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
......
......@@ -176,32 +176,32 @@ summary(object,
<pre class="examples"><div class='input'><span class='co'>## Example from the asia dataset from Lauritzen and Spiegelhalter (1988) provided by Scutari (2010)</span>
<span class='co'>#summary the MCMC run</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>mcmc.out.asia</span>)</div><div class='output co'>#&gt; MCMC summary:
#&gt; Number of Burn in steps: 10000
#&gt; Number of Burn in steps: 1000
#&gt; Number of MCMC steps: 1e+05
#&gt; Thinning: 99
#&gt;
#&gt; Maximum score: -11151.14
#&gt; Empirical mean: -11696.06
#&gt; Empirical standard deviation: 544.0571
#&gt; Maximum score: -11151.13
#&gt; Empirical mean: -11322.76
#&gt; Empirical standard deviation: 337.337
#&gt; Quantiles of the posterior network score:
#&gt; 0.025 0.25 0.5 0.75 0.975
#&gt; BN score -13198.51 -12149.93 -11499.1 -11271.92 -11156.35
#&gt; BN score -12350.22 -11278.52 -11181.1 -11156.04 -11151.13
#&gt;
#&gt;
#&gt; Global acceptance rate: 0.2577423
#&gt; Global acceptance rate: 0.1638362
#&gt; Accepted Rejected
#&gt; MBR 0 32
#&gt; MC3 247 698
#&gt; REV 11 13
#&gt; MBR 10 27
#&gt; MC3 144 795
#&gt; REV 10 15
#&gt;
#&gt;
#&gt; Sample size adjusted for autocorrelation: 380.8894
#&gt; Sample size adjusted for autocorrelation: 325.5766
#&gt;
#&gt; Autocorrelations by lag:
#&gt; 0 1 2 3 4 5 6
#&gt; acf 1 0.3996997 0.2091346 0.07279787 0.04835775 0.03308019 0.00552735
#&gt; 7 8 9 10
#&gt; acf 0.0004674749 -0.01328015 -0.02254146 -0.01459581</div></pre>
#&gt; 0 1 2 3 4 5 6 7
#&gt; acf 1 0.4338829 0.213675 0.1552886 0.1088207 0.0889256 0.07131714 0.01286986
#&gt; 8 9 10
#&gt; acf 0.01950408 -0.02595695 0.01850446</div></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
......
......@@ -161,7 +161,7 @@ max(mcmc.out.asia$scores)
#maximum scoring network using exact search (not MCMC based)
dag <- mostprobable(score.cache = bsc.compute.asia)
fitabn(dag.m = dag,data.df = asia, data.dists = dist.asia)$mlik
fitabn(object = dag,data.df = asia, data.dists = dist.asia)$mlik
```
One can plot the output using the *plot()*. On the graph below, one can see the trace plot of the posterior structure score. The dashed red line is the maximum reached score (as expected = -11151). The coloured dots on the trace plot indicate when different methods have been used. The densities on the left represent the relative occurring frequencies of the methods.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment