-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsoftware_instructions.html
More file actions
546 lines (518 loc) · 31.4 KB
/
software_instructions.html
File metadata and controls
546 lines (518 loc) · 31.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.3.340">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>Software instructions</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
vertical-align: middle;
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
}
pre.numberSource { margin-left: 3em; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
</style>
<script src="software_instructions_files/libs/clipboard/clipboard.min.js"></script>
<script src="software_instructions_files/libs/quarto-html/quarto.js"></script>
<script src="software_instructions_files/libs/quarto-html/popper.min.js"></script>
<script src="software_instructions_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="software_instructions_files/libs/quarto-html/anchor.min.js"></script>
<link href="software_instructions_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="software_instructions_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="software_instructions_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="software_instructions_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="software_instructions_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
</head>
<body class="fullcontent">
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">Software instructions</h1>
</div>
<div class="quarto-title-meta">
</div>
</header>
<p>Since both <code>R</code> and <code>BUGS</code> (or <code>JAGS</code>, which is an alternative Bayesian software) are free, you can install them on your own laptop/desktop, if you want.</p>
<p>The following gives you a quick guide on how you install the software that is required for the analyses that we will go through in the practicals:</p>
<ul>
<li><p><code>OpenBUGS</code><br>
</p></li>
<li><p><code>JAGS</code> (optional)<br>
</p></li>
<li><p><code>R</code> and specifically the packages <code>R2OpenBUGS</code> and <code>BCEA</code>. Other optional packages (e.g. <code>reshape</code>, <code>dplyr</code>, <code>INLA</code> and <code>R2jags</code>) may need to be installed</p></li>
<li><p>The <code>R</code> front-end <code>Rstudio</code> (optional)</p></li>
</ul>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Tip
</div>
</div>
<div class="callout-body-container callout-body">
<p>Notice that you don’t have to install both <code>OpenBUGS</code> <strong>and</strong> <code>JAGS</code> — the former is sufficient for the purposes of this course.</p>
</div>
</div>
<section id="specific-installation-instructions-r-bugs-and-jags" class="level3">
<h3 class="anchored" data-anchor-id="specific-installation-instructions-r-bugs-and-jags">Specific installation instructions (<code>R</code>, <code>BUGS</code> and <code>JAGS</code>)</h3>
<div class="callout callout-style-default callout-note no-icon callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-2-contents" aria-controls="callout-2" aria-expanded="false" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
MS Windows users
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-2" class="callout-2-contents callout-collapse collapse">
<div class="callout-body-container callout-body">
<p>If you are a <code>Windows</code> user, your setting should be fairly easy.</p>
<ol type="1">
<li>Download the file <code>OpenBUGS323setup.exe</code> from the webpage <a href="https://www.mrc-bsu.cam.ac.uk/wp-content/uploads/2014/07/OpenBUGS323setup.zip">https://www.mrc-bsu.cam.ac.uk/wp-content/uploads/2014/07/OpenBUGS323setup.zip</a>, extract the <code>exe</code> file from the downloaded <code>zip</code> file and run it by double-clicking on it.<br>
</li>
<li>Download <code>R</code> from <a href="http://cran.r-project.org/bin/windows/">http://cran.r-project.org/bin/windows/</a> (click on the link “install R for the first time”“).<br>
</li>
<li>Once you have installed <code>R</code>, open it and type in the terminal the command <code>install.packages("R2OpenBUGS")</code>. This command will download the package <code>R2OpenBUGS</code>, which is needed to interface <code>OpenBUGS</code> with <code>R</code>. Follow the on-screen instructions (you will be asked to select a “mirror from which to obtain the file).<br>
</li>
<li>Make sure that the download has worked by typing in the terminal the command <code>library(R2OpenBUGS)</code>. If you do not see any error message, then the package has been successfully installed.<br>
</li>
<li>Install the <code>BCEA</code> package that we will use throughout the practicals, by typing <code>install.packages("BCEA")</code>.<br>
</li>
<li>Repeat the installation process for the other packages that are used in the practicals (e.g. <code>reshape</code> and <code>dplyr</code>). Since this is optional, you can leave this final step to when it is actually needed.</li>
</ol>
<p>If you like, you can also install <code>JAGS</code>, following these steps.</p>
<ol type="1">
<li>Go to <a href="http://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Windows/">http://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Windows/</a> and click on the latest available executable file (currently, <a href="https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Windows/JAGS-4.3.1.exe/download"><code>JAGS-4.3.1.exe</code></a>). Running this file will install <code>JAGS</code> on your machine.<br>
</li>
<li>If you do so, then in the <code>R</code> terminal type the command <code>install.packages("R2jags")</code>. This will allow you to use <code>JAGS</code> (instead of <code>OpenBUGS</code>) when doing the practicals — notice that to make a package available you will have to load it to the workspace by using the <code>library(name_package)</code> command.</li>
</ol>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-6-contents" aria-controls="callout-6" aria-expanded="false" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Linux or Mac OS users
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-6" class="callout-6-contents callout-collapse collapse">
<div class="callout-body-container callout-body">
<section id="installing-r-and-bcea" class="level3">
<h3 class="anchored" data-anchor-id="installing-r-and-bcea">Installing <code>R</code> and <code>BCEA</code></h3>
<p><code>Linux</code> or <code>Mac OS</code> users should follow slightly different approaches. The installation of <code>R</code> is pretty much the same as for <code>MS WIndows</code> users. From the webpage <a href="http://cran.r-project.org/">http://cran.r-project.org/</a> select your operating system (<code>Linux</code> or <code>Mac OS</code>) and then your version (eg <code>debian</code>, <code>redhat</code>, <code>suse</code> or <code>ubuntu</code>, for <code>Linux</code>). Follow the instructions to install the software. Once this is done, open <code>R</code> and install the package <code>BCEA</code> by typing at the terminal the command <code>install.packages("BCEA")</code>. You can use similar commands to install other packages.</p>
</section>
<section id="installing-openbugs-and-jags-in-linux" class="level3">
<h3 class="anchored" data-anchor-id="installing-openbugs-and-jags-in-linux">Installing <code>OpenBUGS</code> and <code>JAGS</code> in <code>Linux</code></h3>
<p>While both <code>OpenBUGS</code> and <code>JAGS</code> run natively in <code>Linux</code> (see below for details on how to install them directly), the graphical interface is not available for <code>OpenBUGS</code>.</p>
<!--
Because we will use it for at least the first few practicals, it is advisable to install `wine`, a "compatibility layer"" that allows to run `Windows` applications from `Linux` or `Mac`. Instructions are available at [https://www.winehq.org/download/](https://www.winehq.org/download/).
When you have installed `wine`, you can also install `OpenBUGS`, which you will be then able to access using the graphical interface, by following these steps.
1. Go to the webpage [https://www.mrc-bsu.cam.ac.uk/wp-content/uploads/2014/07/OpenBUGS323setup.zip](https://www.mrc-bsu.cam.ac.uk/wp-content/uploads/2014/07/OpenBUGS323setup.zip), extract from the `.zip` file the windows executable file `OpenBUGS323setup.exe` and place it in your default directory for `wine` programs (usually `~/.wine/drive_c`).
2. Run the `OpenBUGS` installer
- Open a terminal window;
- Move to the directory where you placed the `OpenBUGS` executable you downloaded in step 1, something like: `cd ~/.wine/drive_c`
- Type: `wine OpenBUGS323setup.exe`;
- Wait for a while and then follow the prompts to install --- by default, the installation folder is `~/.wine/drive_c/Program Files/OpenBUGS323`
- NB: There may be an error at the end, this is OK. Close down the Terminal Window
3. Test `OpenBUGS` by opening a new terminal window typing the command: `wine ~/.wine/drive_c/Program Files/OpenBUGS323/OpenBUGS.exe`
4. Download the `R2OpenBUGS` package from [http://www.openbugs.info/w/UserContributedCode](http://www.openbugs.info/w/UserContributedCode)
5. Open `R` and install `R2OpneBUGS` by typing the command `install.packages("R2OpenBUGS")`
-->
<p>You can install the <code>Linux</code> version of <code>OpenBUGS</code> (available from <a href="https://www.mrc-bsu.cam.ac.uk/wp-content/uploads/2018/04/OpenBUGS-3.2.3.tar.gz">here</a>) by following the instructions given at <a href="https://www.mrc-bsu.cam.ac.uk/software/bugs/openbugs/building-and-packaging-openbugs/openbugs-linux-installation/">https://www.mrc-bsu.cam.ac.uk/software/bugs/openbugs/building-and-packaging-openbugs/openbugs-linux-installation/</a>. This will work just as well, but you won’t be able to access the graphical interface (which, again, is not really a problem, in our case…).</p>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Warning
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>NB</strong>: Under <code>Linux</code>, you may need to also install additional packages to support the <code>OpenBUGS</code> installation. For instance, under <code>Debian</code> or <code>Ubuntu</code>, you may need to also run in your terminal</p>
<pre><code>sudo apt-get install g++-multilib</code></pre>
<p>to install the library <code>g++multilib</code>.</p>
</div>
</div>
<p>In addition, you can also install <code>JAGS</code>. Depending on your specific distribution of <code>Linux</code>, you may use a very simple command or need to install from source. If you are under <code>Ubuntu</code> or <code>Debian</code>, you can simply type in your terminal</p>
<pre><code>sudo apt install jags</code></pre>
<p>to install <code>JAGS</code>.</p>
<p>Alternatively, the source installation (which would work for <em>all</em> <code>Linux</code> distributions) is done following these steps.</p>
<ol type="1">
<li>Go to <a href="http://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/">http://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/</a> and download the latest <code>tar.gz</code> file (currently, <a href="https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/JAGS-4.3.1.tar.gz/download"><code>JAGS-4.3.1.tar.gz</code></a>)<br>
</li>
<li>Open a terminal window and extract the content of the archive file by typing the command <code>tar xzvf JAGS-4.3.1.tar.gz</code><br>
</li>
<li>Move to the directory (which has just been created) using the command <code>cd JAGS-4.3.1</code><br>
</li>
<li>Run the configuration by typing <code>sudo ./configure --prefix=/us && sudo make && sudo make install</code><br>
</li>
<li>Clean up the unnecessary files and folder by typing <code>cd .. && sudo rm -fr JAGS-4.3.1 && rm JAGS-4.3.1.tar.gz</code></li>
</ol>
<p>Either way, if you decide to work with <code>JAGS</code>, then open <code>R</code> and also install the package <code>R2JAGS</code> (using the same command as for the installation of the package <code>R2OpneBUGS</code>). Notice that you don’t have to install both <code>OpenBUGS</code> and <code>JAGS</code> — the former is sufficient for the purposes of this course.</p>
</section>
<section id="installing-openbugs-and-jags-in-mac-os" class="level3">
<h3 class="anchored" data-anchor-id="installing-openbugs-and-jags-in-mac-os">Installing <code>OpenBUGS</code> and <code>JAGS</code> in <code>Mac OS</code></h3>
<p>While similar in spirit, installation under <code>Mac OS</code> is slightly more complex, because the process requires some extra software that is not automatically installed. Basically, you need to follow this procedure, as detailed at the website <a href="http://www.jkarreth.net/bayes-icpsr.html#bugsmac">http://www.jkarreth.net/bayes-icpsr.html#bugsmac</a>. Basically, you first install a <code>Windows</code> “a compatibility layer” (<code>wine</code>), which allows you to run <code>Windows</code> applications on other operating systems. This will also allow you to use the <code>OpenBUGS</code> graphical interface (although, again, we will not, in the practicals!).</p>
<ol type="1">
<li>Update your <code>Mac OS</code> to the newest version.<br>
</li>
<li>Install <code>Xcode</code> through the <a href="https://apps.apple.com/us/app/xcode/id497799835?mt=12">App Store</a>.<br>
</li>
<li>Check if you have <code>X11</code> installed (this is a a windowing system, common on <code>Unix</code>-like operating systems, which, believe it or not, <code>MaxOs</code> is!): hit Command-Space, type <code>X11</code>, and see if the program shows up. If not, install it from <a href="http://xquartz.macosforge.org/">here</a>.<br>
</li>
<li>Download a the stable pre-compiled version of <a href="https://dl.winehq.org/wine-builds/macosx/download.html"><code>wine</code></a>. Instructions to install <code>wine</code> on <code>Mac OS</code> are available <a href="https://www.embird.net/sw/embird/tutorial/wine/wine.htm">here</a>.<br>
</li>
<li>Download <code>OpenBUGS323setup.exe</code> (windows executable) and place it in your default directory for <code>wine</code> programs (usually <code>~/.wine/drive_c</code>).<br>
</li>
<li>Run the <code>OpenBUGS</code> installer:
<ul>
<li>Open <code>XQuartz</code> and a Terminal Window;</li>
<li>Move to the directory where you placed the <code>OpenBUGS</code> executable you downloaded in step 2;</li>
<li>Type: <code>wine OpenBUGS323setup.exe</code>;</li>
<li>Wait for a while and then follow the prompts to install — remember the directory you created to install it (default is <code>~/[username]/.wine/drive_c/Program Files/OpenBUGS323</code>)</li>
<li>NB: There may be an error at the end, this is OK. Close down the Terminal Window</li>
</ul></li>
<li>It is possible that you need to specify the installation directory to tell your system specifically where to look for <code>BUGS</code>. Typically this will mean adding the option <code>bugs.directory = "/Users/yourusername/.wine/drive_c/Program Files/OpenBUGS232"</code> (or similar, depending on where you have installed the software!) to the call to the <code>bugs</code> function under <code>R2OpenBUGS</code>. Note that you need to replace “yourusername” with your Mac’s user name.</li>
</ol>
<p>Notice that, if you like, you can install <code>R</code> under <code>wine</code> (rather than natively in <code>Mac OS</code>). Download the <code>MS Windows</code> executable file from <code>CRAN</code> and repeat the instructions above, replacing the command <code>wine OpenBUGS323setup.exe</code> with the command <code>wine R-XXXX.exe</code>, where <code>R-XXXX.exe</code> is the name of the executable file.</p>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Warning
</div>
</div>
<div class="callout-body-container callout-body">
<p>There are some reports that <code>OpenBUGS</code> may fail to work on some <code>Mac OS</code> versions. Sometimes, when trying to use <code>OpenBUGS</code> from <code>R</code>, it will complain that it can’t find the programme. The <code>bugs</code> function in the <code>R2OpenBUGS</code> package takes an additional input <code>OpenBUGS.pgm</code>, which should be set to the full path to the <code>OpenBUGS</code> executable file. You can try and issue the <code>R</code> command <code>Sys.which("OpenBUGS")</code> at a <code>R</code> terminal and see whether it returns a full path and then pass <em>that</em> string as value for <code>OpenBUGS.pgm</code>, eg if <code>Sys.which("OpenBUGS")</code> returns the string <code>/usr/local/bin/OpenBUGS</code>, then set</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">bugs</span>(..., <span class="at">OpenBUGS.pgm=</span><span class="st">"/usr/local/bin/OpenBUGS"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
<p>In addition, you can also install <code>JAGS</code>, following these steps, as detailed at the webpage <a href="http://www.jkarreth.net/bayes-icpsr.html#jagsmac">http://www.jkarreth.net/bayes-icpsr.html#jagsmac</a>.</p>
<ol type="1">
<li>Install the most recent version of <code>R</code> from the <a href="https://cran.r-project.org/bin/macosx/"><code>CRAN</code> website</a>.<br>
</li>
<li>(Optional) Download and install <a href="https://rstudio.com/products/rstudio/download/#download">RStudio</a> (NB: select the version for the your release of <code>MacOS</code>!).<br>
</li>
<li>Install <code>Clang</code> (currently <code>clang-8.0.0.pkg</code>) and GNU Fortran (currently, <code>gfortran-6.1.pkg.dmg</code>) from the <a href="http://cran.r-project.org/bin/macosx/tools/">CRAN tools directory</a>. Note that the most updated release for these may vary so check you select the correct one.<br>
</li>
<li>Now install <code>JAGS</code> version 4.3.1 (<code>JAGS-4.3.1.pkg</code>) from <a href="https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Mac%20OS%20X/JAGS-4.3.1.pkg/download">here</a>. Detailed instructions quoted from the <code>JAGS</code> readme file:
<ul>
<li>Download the disk image from the <code>JAGS</code> website.</li>
<li>Double click on the disk image to mount (this may not be required).</li>
<li>Double click on the <code>JAGS-4.3.1.pkg</code> file within the mounted disk image.</li>
<li>Follow the instructions in the installer. If you receive a warning that this software cannot be installed because it comes from an unidentified developer, you need to go to “System Preferences”” > “Security & Privacy”“, and authorize the installation there before proceeding.</li>
<li>Authenticate as the administrative user. The first user you create when setting up <code>Mac OS X</code> has administrator privileges by default.</li>
</ul></li>
<li>Start the Terminal and type <code>jags</code> to see if you receive the message: Welcome to <code>JAGS 4.3.1</code>.<br>
</li>
<li>Open <code>R</code> and install the packages <code>R2jags</code>, <code>coda</code>, <code>R2WinBUGS</code>, <code>lattice</code>, and <code>rjags</code>, by typing <code>install.packages(c("R2jags", "coda", "R2WinBUGS", "lattice", "rjags"))</code> in the <code>R</code> command line.</li>
</ol>
<p>You may also try installing <code>JAGS</code> on your <code>Mac</code> using <a href="https://ports.macports.org/port/jags/">MacPorts</a>, by typing in your terminal</p>
<pre><code>sudo port install jags</code></pre>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Tip
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>NB</strong>: <a href="https://sourceforge.net/p/mcmc-jags/discussion/610037/thread/07e08a3605/?limit=25#1160">This</a> post may be helpful in finding instructions to install <code>JAGS</code> under <code>MacOs</code>. In general, the <a href="https://sourceforge.net/projects/mcmc-jags/"><code>JAGS</code></a> <code>sourceforge</code> page has several posts/requests for help that you may find very similar to your own.</p>
</div>
</div>
</section>
</div>
</div>
</div>
</section>
</main>
<!-- /main column -->
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
const toggleBodyColorMode = (bsSheetEl) => {
const mode = bsSheetEl.getAttribute("data-mode");
const bodyEl = window.document.querySelector("body");
if (mode === "dark") {
bodyEl.classList.add("quarto-dark");
bodyEl.classList.remove("quarto-light");
} else {
bodyEl.classList.add("quarto-light");
bodyEl.classList.remove("quarto-dark");
}
}
const toggleBodyColorPrimary = () => {
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
if (bsSheetEl) {
toggleBodyColorMode(bsSheetEl);
}
}
toggleBodyColorPrimary();
const icon = "";
const anchorJS = new window.AnchorJS();
anchorJS.options = {
placement: 'right',
icon: icon
};
anchorJS.add('.anchored');
const isCodeAnnotation = (el) => {
for (const clz of el.classList) {
if (clz.startsWith('code-annotation-')) {
return true;
}
}
return false;
}
const clipboard = new window.ClipboardJS('.code-copy-button', {
text: function(trigger) {
const codeEl = trigger.previousElementSibling.cloneNode(true);
for (const childEl of codeEl.children) {
if (isCodeAnnotation(childEl)) {
childEl.remove();
}
}
return codeEl.innerText;
}
});
clipboard.on('success', function(e) {
// button target
const button = e.trigger;
// don't keep focus
button.blur();
// flash "checked"
button.classList.add('code-copy-button-checked');
var currentTitle = button.getAttribute("title");
button.setAttribute("title", "Copied!");
let tooltip;
if (window.bootstrap) {
button.setAttribute("data-bs-toggle", "tooltip");
button.setAttribute("data-bs-placement", "left");
button.setAttribute("data-bs-title", "Copied!");
tooltip = new bootstrap.Tooltip(button,
{ trigger: "manual",
customClass: "code-copy-button-tooltip",
offset: [0, -8]});
tooltip.show();
}
setTimeout(function() {
if (tooltip) {
tooltip.hide();
button.removeAttribute("data-bs-title");
button.removeAttribute("data-bs-toggle");
button.removeAttribute("data-bs-placement");
}
button.setAttribute("title", currentTitle);
button.classList.remove('code-copy-button-checked');
}, 1000);
// clear code selection
e.clearSelection();
});
function tippyHover(el, contentFn) {
const config = {
allowHTML: true,
content: contentFn,
maxWidth: 500,
delay: 100,
arrow: false,
appendTo: function(el) {
return el.parentElement;
},
interactive: true,
interactiveBorder: 10,
theme: 'quarto',
placement: 'bottom-start'
};
window.tippy(el, config);
}
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
for (var i=0; i<noterefs.length; i++) {
const ref = noterefs[i];
tippyHover(ref, function() {
// use id or data attribute instead here
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
try { href = new URL(href).hash; } catch {}
const id = href.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
return note.innerHTML;
});
}
let selectedAnnoteEl;
const selectorForAnnotation = ( cell, annotation) => {
let cellAttr = 'data-code-cell="' + cell + '"';
let lineAttr = 'data-code-annotation="' + annotation + '"';
const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
return selector;
}
const selectCodeLines = (annoteEl) => {
const doc = window.document;
const targetCell = annoteEl.getAttribute("data-target-cell");
const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
const lines = annoteSpan.getAttribute("data-code-lines").split(",");
const lineIds = lines.map((line) => {
return targetCell + "-" + line;
})
let top = null;
let height = null;
let parent = null;
if (lineIds.length > 0) {
//compute the position of the single el (top and bottom and make a div)
const el = window.document.getElementById(lineIds[0]);
top = el.offsetTop;
height = el.offsetHeight;
parent = el.parentElement.parentElement;
if (lineIds.length > 1) {
const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
const bottom = lastEl.offsetTop + lastEl.offsetHeight;
height = bottom - top;
}
if (top !== null && height !== null && parent !== null) {
// cook up a div (if necessary) and position it
let div = window.document.getElementById("code-annotation-line-highlight");
if (div === null) {
div = window.document.createElement("div");
div.setAttribute("id", "code-annotation-line-highlight");
div.style.position = 'absolute';
parent.appendChild(div);
}
div.style.top = top - 2 + "px";
div.style.height = height + 4 + "px";
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
if (gutterDiv === null) {
gutterDiv = window.document.createElement("div");
gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
gutterDiv.style.position = 'absolute';
const codeCell = window.document.getElementById(targetCell);
const gutter = codeCell.querySelector('.code-annotation-gutter');
gutter.appendChild(gutterDiv);
}
gutterDiv.style.top = top - 2 + "px";
gutterDiv.style.height = height + 4 + "px";
}
selectedAnnoteEl = annoteEl;
}
};
const unselectCodeLines = () => {
const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
elementsIds.forEach((elId) => {
const div = window.document.getElementById(elId);
if (div) {
div.remove();
}
});
selectedAnnoteEl = undefined;
};
// Attach click handler to the DT
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
for (const annoteDlNode of annoteDls) {
annoteDlNode.addEventListener('click', (event) => {
const clickedEl = event.target;
if (clickedEl !== selectedAnnoteEl) {
unselectCodeLines();
const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
if (activeEl) {
activeEl.classList.remove('code-annotation-active');
}
selectCodeLines(clickedEl);
clickedEl.classList.add('code-annotation-active');
} else {
// Unselect the line
unselectCodeLines();
clickedEl.classList.remove('code-annotation-active');
}
});
}
const findCites = (el) => {
const parentEl = el.parentElement;
if (parentEl) {
const cites = parentEl.dataset.cites;
if (cites) {
return {
el,
cites: cites.split(' ')
};
} else {
return findCites(el.parentElement)
}
} else {
return undefined;
}
};
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
for (var i=0; i<bibliorefs.length; i++) {
const ref = bibliorefs[i];
const citeInfo = findCites(ref);
if (citeInfo) {
tippyHover(citeInfo.el, function() {
var popup = window.document.createElement('div');
citeInfo.cites.forEach(function(cite) {
var citeDiv = window.document.createElement('div');
citeDiv.classList.add('hanging-indent');
citeDiv.classList.add('csl-entry');
var biblioDiv = window.document.getElementById('ref-' + cite);
if (biblioDiv) {
citeDiv.innerHTML = biblioDiv.innerHTML;
}
popup.appendChild(citeDiv);
});
return popup.innerHTML;
});
}
}
});
</script>
</div> <!-- /content -->
</body></html>