JAGS was developed to help those non-Window users to be able to use BUGS. However, I found it is very hard to install JAGS and its R package-rjags. Here is my note on how to install JAGS and rjags in Fedora 10. The note here should work for all Linux systems.
Compile JAGS
1. Download JAGS source code from JAGS website into any folder. The file you are looking for should look like this JAGS-1.0.3.tar.gz. The version number which might be changed if JAGS is updated.
2. Extract the tar.gz file as: tar xfvz JAGS-1.0.3.tar.gz. This will create a JAGS-1.0.3 folder that contains JAGS files.
3. Go to JAGS folder as: cd JAGS-1.0.3.
4. Do the following to install JAGS:
sudo ./configure
sudo make
sudo make install
sudo is just a Linux command that force to execute command as the administrator
5. Type jags in the terminal console to see if JAGS is installed properly. Quite JAGS by typing exit.
Install rjags
1. In the terminal console, start R as:
sudo R
2. Install rjags. In the R console, type:
install.packages("rjags", configure.args="--with-jags-include=/usr/local/include/JAGS --with-jags-lib=/usr/local/lib/JAGS --with-jags-modules=/usr/local/lib/JAGS/modules")
In each --with above, there is an empty space to separate the code.
The trick here is that rjags will ask for JAGS HEADER file, libraries and modules. So if the above code does not work, search for them and specify the right PATH in the above code.
We have also written a package called R2jags that emulates what R2WinBUGS does. But it depends on rjags. So if you have successfully installed rjags, you might want to try R2jags. It has a powerful feature which is imported from rjags that you can pick up your previous saved MCMC and update it. I have a blog entry that discuss about this feature here.
6 hours ago
25 comments:
Just FYI, on Debian
sudo apt-get install jags
gets you a pre-built version.
On a mac (at time of this writing) I needed to add the flag:
type="source"
Does it work for Mac?
Many Thanks,
Antonio.
Mac OS is a member of linux family. Just make sure you have the latest X11. I believe this post works for Mac users.
Many thanks,
Antonio.
sudo apt-get install jags, won't work.
install lapack
apt-get install libblas-dev liblapack-dev
Thank you, thank you, thank you.
Thanks a lot for this tutorial. Just a small comment: If I am not mistaken, you do not need to be root to do ./configure and make. What you need to do in Step 4 is
./configure
make
sudo make install
What you might want to do in Fedora prior to compiling JAGS is to type at the command line
sudo yum install lapack* blas* atlas*
If you want to install rjags on 64-bit Linux, be sure to check out RogBlog. There is a solution to a common problem that shows how to put the .so files into the correct directory.
If you have already installed JAGS on a 64-bit Linux system and now want to install rjags, an alternative to RogBlog's solution is to create symbolic links:
cd /usr/local/lib64
ln -s ../lib/* .
Note that the above assumes that the only files in /usr/local/lib are those pertaining to JAGS. If there are other files in this directory, you need to manually create symbolic links for
JAGS
libjags.so
libjags.so.1.0.2
libjrmath.so
libjrmath.so.0.0.0
libjags.la
libjags.so.1
libjrmath.la
libjrmath.so.0
pkgconfig
(this list pertains to JAGS 1.0.3). The approach involving symbolic links is less elegant than RogBlog's solution, but it avoids having to recompile JAGS in case JAGS is already installed.
What a great article, i got a lot of things from here. Thanks!
regards,
Anthony
So, I'm running these on MAC OS X v 10.5.8 and trying to install. I keep getting an error message because g++-4.2 is not found. Do you know if I have to install that compiler or if there's a way to get it to use the version of gcc that I currently have installed?
Thanks so much!!!!
PS -- I was able to install it by updating my apple tools, and using their gcc compiler. Other distributions of gcc through the ports did not work!
To Elana,
You should also have the latest X11 to make the whole process works.
To avoid being root, you can use the --prefix option when installing JAGS to specify where it's installed.
When doing that, though, I've had to use dyn.load to load in the dynamic libraries libjags.so and libjrmath.so to get rjags to work.
Has anyone found a way around this? Can you force rjags to recognize this location during the setup?
Hi, I don't know how old this post is but I've just submitted JAGS, coda, and rjags spec & srpm files to Fedora and hope to start maintaining these programs in Fedora. If anyone is interested, I currently have the RPMs for JAGS, coda, and rjags on my blog ...
http://cddesjardins.wordpress.com/2010/06/04/jags-package-for-fedora-13-64-bit/
After you install my JAGS rpms (both jags and jags-devel) all you need to do to install rjags is open up R and run install.packages("rjags") and everything should install fine.
I would also be interested in maintaing your R2jags program too.
I also wanted to add that there is now a i386 RPM for JAGS up on my blog as well.
Hi there,
I just installed the rjags package on R 2.11.0 running on OS X 10.5.8 but when I tried to load the library I got the following error message:
library("rjags")
Error : .onLoad failed in loadNamespace() for 'rjags', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared library '/Library/Frameworks/R.framework/Resources/library/rjags/libs/i386/rjags.so':
dlopen(/Library/Frameworks/R.framework/Resources/library/rjags/libs/i386/rjags.so, 10): Library not loaded: /usr/local/lib/libjags.1.dylib
Referenced from: /Library/Frameworks/R.framework/Resources/library/rjags/libs/i386/rjags.so
Reason: image not found
Error: package/namespace load failed for 'rjags'
Does anybody have any idea how I could solve it?
Many thanks in advance,
Ruben
Hi
I have opensuse.
I installed jags but I can not install rjags in R.
here is the log. Let me know what to do.
Selection: 63
trying URL 'http://cran.opensourceresources.org/src/contrib/rjags_2.2.0-3.tar.gz'
Content type 'application/x-gzip' length 62581 bytes (61 Kb)
opened URL
==================================================
downloaded 61 Kb
* installing *source* package ârjagsâ ...
checking for prefix by checking for jags... /usr/bin/jags
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking Console.h usability... no
checking Console.h presence... no
checking for Console.h... no
configure: error: in `/tmp/RtmpLc3krc/R.INSTALL65d940e4/rjags':
configure: error: "Problem with header file /usr/include/JAGS/Console.h "
See `config.log' for more details.
ERROR: configuration failed for package ârjagsâ
* removing â/home/users/farhadsh/R/x86_64-unknown-linux-gnu-library/2.12/rjagsâ
The downloaded packages are in
â/tmp/RtmpXIbYcN/downloaded_packagesâ
Warning message:
In install.packages("rjags") :
installation of package 'rjags' had non-zero exit status
If going the easy way, don't forget to install the devel stuff as well. For example on OpenSUSE, also grab:
http://software.opensuse.org/package/jags3-devel
Even setting the paths for lib, module and include on install.packages(), it's still not working. I'm using a CentOS7. Any ideas?
Thanks!
In an increasingly technological world, event promotion isn’t just about pounding the pavement anymore. Whether you’re attempting to drive ticket sales to a corporate convention, wellness retreat, music festival, or monthly farmer’s market, advertising on social media could help increase attendance at your event. event management With over 211 million Twitter users reported last quarter, learning how to promote an event on Twitter could help take your event marketing to the next level. define debrief, what is hospitality mean, guerilla marketing definition, what is nft, direct sales vendor events, thank you letter for meeting and networking event invitation
15 programas gratis para Windows Live Wallpaper For Pc, Free Wallpaper Backgrounds, ... Dark Of Systems Rainmeter Pack - free desktop themes download.
Post a Comment