BwUniCluster2.0/Software/R/Rjags: Difference between revisions
< BwUniCluster2.0 | Software | R
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 12: | Line 12: | ||
#Load R module |
#Load R module |
||
module load math/R/4.1.2 |
module load math/R/4.1.2 |
||
# Set up JAGS installation directory |
# Set up JAGS installation directory |
||
⚫ | |||
⚫ | |||
# Prepare JAGS source directory (if not yet existing) |
# Prepare JAGS source directory (if not yet existing) |
||
mkdir -p ~/src |
mkdir -p ~/src |
||
cd ~/src |
cd ~/src |
||
Line 25: | Line 24: | ||
# Get JAGS source |
# Get JAGS source |
||
wget https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/JAGS-4.3.1.tar.gz |
wget https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/JAGS-4.3.1.tar.gz |
||
tar xf JAGS-4.3.1.tar.gz |
tar xf JAGS-4.3.1.tar.gz |
||
cd JAGS-4.3.1 |
cd JAGS-4.3.1 |
||
rm JAGS-4.3.1.tar.gz |
rm JAGS-4.3.1.tar.gz |
||
Line 46: | Line 42: | ||
export PKG_CONFIG_PATH=$JAGS_HOME/lib/pkgconfig |
export PKG_CONFIG_PATH=$JAGS_HOME/lib/pkgconfig |
||
export LD_RUN_PATH=$JAGS_HOME/lib |
export LD_RUN_PATH=$JAGS_HOME/lib |
||
Line 53: | Line 48: | ||
> install.packages("rjags", configure.args="--enable-rpath") |
> install.packages("rjags", configure.args="--enable-rpath") |
||
> library(rjags) |
> library(rjags) |
||
---- |
---- |
Revision as of 12:06, 23 June 2022
General information
rjags is a R interface to use JAGS, Just another Gibbs Sampler. JAGS is a program for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation
rjags needs a JAGS installation on the side. We recommend to compile via Intel compiler and with the Intel MKL library (Intel Math Kernel Library), which allows JAGS to use various efficient implementations of mathematical computations. These are, as of now, loaded alongside with the module R 4.1.2.
Installation
#Load R module module load math/R/4.1.2 # Set up JAGS installation directory export JAGS_HOME=$HOME/sw/jags # Prepare JAGS source directory (if not yet existing) mkdir -p ~/src cd ~/src # Get JAGS source wget https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/JAGS-4.3.1.tar.gz tar xf JAGS-4.3.1.tar.gz cd JAGS-4.3.1 rm JAGS-4.3.1.tar.gz # Install JAGS export CFLAGS="-O3 -axCORE-AVX512,CORE-AVX2,AVX -xSSE4.2 -fp-model strict -qopenmp" export CXXFLAGS="-O3 -std=c++14 -axCORE-AVX512,CORE-AVX2,AVX -xSSE4.2 -fp-model strict -qopenmp" ./configure --prefix=$JAGS_HOME --with-blas="-lmkl_rt -lpthread -lm" make make install cd # Set up environment export PKG_CONFIG_PATH=$JAGS_HOME/lib/pkgconfig export LD_RUN_PATH=$JAGS_HOME/lib # Install rjags package from within R session R -q > install.packages("rjags", configure.args="--enable-rpath") > library(rjags)