{"id":3318,"date":"2019-05-22T13:16:55","date_gmt":"2019-05-22T12:16:55","guid":{"rendered":"http:\/\/ri.itservices.manchester.ac.uk\/csf3\/?page_id=3318"},"modified":"2020-11-20T10:19:43","modified_gmt":"2020-11-20T10:19:43","slug":"jags","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/software\/applications\/jags\/","title":{"rendered":"JAGS"},"content":{"rendered":"<h2>Overview<\/h2>\n<p><a href=\"http:\/\/mcmc-jags.sourceforge.net\/\">JAGS<\/a> is Just Another Gibbs Sampler. It is a program for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation not wholly unlike BUGS. JAGS was written with three aims in mind:<\/p>\n<ul>\n<li>To have a cross-platform engine for the BUGS language<\/li>\n<li>To be extensible, allowing users to write their own functions, distributions and samplers.<\/li>\n<li>To be a platform for experimentation with ideas in Bayesian modelling<\/li>\n<\/ul>\n<p>It is often used alongside the R package R2jags which provides wrapper functions and can be installed from CRAN.<\/p>\n<p>The RJAGS libraries will also be used if you install the <code>rjags<\/code> or <code>JMbayes<\/code> R packages. Please see the note below about which version of RJAGS you should use for this purpose.<\/p>\n<h2>Restrictions on use<\/h2>\n<p>All users may access and use JAGS.<\/p>\n<p>JAGS is licensed under the GNU General Public License version 2. You may freely modify and redistribute it under certain conditions.<\/p>\n<h2>Set up procedure<\/h2>\n<p>We now recommend loading modulefiles within your jobscript so that you have a full record of how the job was run. See the example jobscript below for how to do this. Alternatively, you may load modulefiles on the login node and let the job <abbr title=\"add '#$ -V' to your jobscript\">inherit these settings<\/abbr>.<\/p>\n<p>Load one of the following modulefiles:<\/p>\n<pre>\r\nmodule load apps\/gcc\/jags\/4.3.0              # Suitable for standalone use (system-wide GCC 4.8.5)\r\n\r\nmodule load apps\/gcc\/jags\/4.3.0-gcc-8.2.0    # Use to install packages that use rjags in R 3.6.2.\r\n<\/pre>\n<h2>Running the application<\/h2>\n<p>Please do not run JAGS commands on the login node. <code>qrsh<\/code> is recommended for some commands. Computationally intense work should be done via the batch system.<\/p>\n<h3>Examples<\/h3>\n<p>The following example first runs <code>jags<\/code> as a serial job.<\/p>\n<pre>\r\n#!\/bin\/bash --login\r\n#$ -cwd\r\nmodule load apps\/gcc\/jags\/4.3.0\r\n\r\njags &lt;script file&gt;\r\n<\/pre>\n<p>and submit the job using <code>qsub <em>jobscript<\/em><\/code> where jobscript is the name of your job script file.<\/p>\n<h3>Installing R packages<\/h3>\n<p>Additional R packages such as JMbayes can be installed in to your home area. This is covered in more detail in the <a href=\"..\/R\">CSF R documentation<\/a> but here is a quick example of installing a package named JMbayes which uses JAGS:<\/p>\n<pre>\r\nmodule load tools\/env\/proxy\r\nmodule load apps\/gcc\/R\/3.6.2                # Uses GCC 8.2.0\r\nmodule load apps\/gcc\/jags\/4.3.0-gcc-8.2.0   # Use the gcc-8.2.0 compatible version\r\nR\r\ninstall.packages(\"JMbayes\")\r\nlibrary(JMbayes)\r\n<\/pre>\n<p>You will be asked to select a <em>mirror<\/em> site from which to download the JMbayes packages (we typically use the Bristol UK mirror). Once the package has been installed, the <code>library(JMbayes)<\/code> command should be used each time you wish to use the package.<\/p>\n<h2>Further info<\/h2>\n<ul>\n<li><a href=\"https:\/\/sourceforge.net\/projects\/mcmc-jags\/files\/Manuals\/4.x\/jags_user_manual.pdf\">JAGS Manual<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Overview JAGS is Just Another Gibbs Sampler. It is a program for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation not wholly unlike BUGS. JAGS was written with three aims in mind: To have a cross-platform engine for the BUGS language To be extensible, allowing users to write their own functions, distributions and samplers. To be a platform for experimentation with ideas in Bayesian modelling It is often used alongside the.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/software\/applications\/jags\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"parent":86,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3318","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/3318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/comments?post=3318"}],"version-history":[{"count":5,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/3318\/revisions"}],"predecessor-version":[{"id":4842,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/3318\/revisions\/4842"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/86"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/media?parent=3318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}