Jags Wald module
Switch branches/tags
Clone or download
Pull request Compare This branch is even with HelenSteingroever:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples/SWmixturesCode
src
win
.gitignore
AUTHORS
ChangeLog
Makefile.am
NEWS
README
configure.ac

README

JAGS Wald module
================
Provides shifted Wald (Inverse Gaussian) distribution functions for JAGS.

JAGS Extensions provided
------------------------

Distributions
"""""""""""""
- dswald: Shifted Wald distribution
- dswtn: Shifted Wald distribution with across-trial variability in the Wald
  drift rate parameter governed by a truncated normal distribution

Functions
"""""""""
- dswald: Shifted Wald density function
- pswald: Shifted Wald cumulative density function

Abandoned Functionality
"""""""""""""""""""""""
- dswgam: Shifted Wald distribution with across-trial variability in the Wald 
  drift rate parameter governed by a gamma distribution. This function was
  abandoned due to various reasons. However, the examples provided show how this 
  can be implemented using a for-loop construction.

Examples
--------
The examples/SWmixturesCode directory contains all files that are necessary
to fit the SW-TN and SW-GAM mixtures as described in Steingroever,
Wabersich, & Wagenmakers (submitted). R and JAGS are necessary to fit the
models. 

1. Fit_IG_TN_ind.r:  R code to generate data and to fit the IG-TN mixture.
2. Fit_IG_GAM_ind.r: R code to generate data and to fit the IG-GAM mixture.
3. Model_IG_TN_ind.txt:  JAGS model file of the IG-TN mixture. This file is
   needed to run the Fit_IG_TN_ind.r code.
4. Model_IG_GAM_ind.txt: JAGS model file of the IG-GAM mixture. This file is 
   needed to run the Fit_IG_GAM_ind.r code.

Please note
-----------
When using this code or module, please cite as: 
  Steingroever, Wabersich, & Wagenmakers (submitted). Modeling Across-Trial
  Variability in the Wald Drift Rate Parameter.

License
-------
http://www.r-project.org/Licenses/GPL-2

Installation
------------

Linux and Mac
"""""""""""""
Use the tarball and install as usual: 
  ./configure && make && sudo make install

Note: It might be necessary to define a different prefix, depending on
where JAGS is copied (i.e. installed), for example:

  ./configure --prefix /usr && make && sudo make install

Windows
"""""""
For Windows we provide precompiled binaries, which come with an
installer. See the releases page for the Windows installer.

Compiling from a cloned repository
----------------------------------
# dependencies (on a clean ubuntu installation)
sudo apt-get install autoconf automake libtool g++

# creating all auxiliary files
autoreconf -fvi

# building
./configure
make

# or, if JAGS has been installed in a different location, e.g. /usr
./configure --prefix /usr
make

# install
sudo make install

Windows Compiling 
"""""""""""""""""

**First, in Linux:**

- For building the module in Windows, it is easiest to use a tarball that
  was created in linux like this (starting from a source clone):

    autoreconf -fvi
    ./configure
    make dist-gzip

- As an alternative to building this tarball yourself from the github
  source, one can use the tarball that is available for the latest release.

- Copy the *.tar.gz file to your msys home directory and continue from
  there.

**Second, in Windows:**

- Install MinGW (MinGW installer including msys):
  http://www.mingw.org
  In MinGW get installer: msys-base is all you need.

- Install TDM-GCC Compiler Suite:
  http://tdm-gcc.tdragon.net 
  Use the exact same version of tdm-gcc as has been used to compile your
  JAGS Version on your system. In that case, also don't forget to untick
  the  "Check for updated files on the TDM-GCC server" 
  during the installation proccess of tdm-gcc. 
  For Jags-4.0.0 and Jags-4.1.0 use: 
  tdm64-gcc-4.6.1.exe
  For Jags-4.2.0 use: 
  tdm64-gcc-4.9.2-3.exe
  
- Delete all *.dll.a files int the TDM-GCC Installation, so the
  compiler will link to the static libraries.

- Change path in c:/mingw/msys/1.0/etc/fstab from
  this:     c:/mingw /mingw
  to:       c:/MinGW64 /mingw
  to use TDM-GCC compilers

- Alternatively to TDM-GCC, you could also use Rtools
  (https://cran.r-project.org/bin/windows/Rtools/).
  For Jags-4.2.0 use:
  Rtools33.exe

  Change path in c:/mingw/msys/1.0/etc/fstab
  to:       C:/Rtools/mingw_64 /mingw
  to use Rtools compilers

- --> Start msys, extract tarball in your home dir, 
      cd into dir and do the following:

- *Note*: the module needs the JAGS include files and
  the JAGS libraries.
  Therefore use the -L and -I options, as shown below.

- For building 32bit binaries:

  CXX="g++ -m32" \
  ./configure LDFLAGS="-L/c/Progra~1/JAGS/JAGS-4.2.0/i386/bin" CXXFLAGS="-I/c/Progra~1/JAGS/JAGS-4.2.0/include"

  make win32-install

- For building 64bit binaries:

  CXX="g++ -m64" \
  ./configure LDFLAGS="-L/c/Progra~1/JAGS/JAGS-4.2.0/x64/bin" CXXFLAGS="-I/c/Progra~1/JAGS/JAGS-4.2.0/include"

  make win64-install

- Copy the win/win32/wald.* or win/win64/wald.* 
  files to your JAGS modules directory to enable the module.
  For JAGS-4.2.0 this usually is: 
  x64: C:\Program Files\JAGS\JAGS-4.2.0\x64\modules
  x32: C:\Program Files\JAGS\JAGS-4.2.0\x32\modules

- *Note*: If you compile both 32bit and 64bit don't forget to make clean
  between the building.

- *All Windows commands in one* (for copy paste convenience)

  CXX="g++ -m32" \
  ./configure LDFLAGS="-L/c/Progra~1/JAGS/JAGS-4.2.0/i386/bin" \
  CXXFLAGS="-I/c/Progra~1/JAGS/JAGS-4.2.0/include" && \
  make win32-install && \
  make clean && \
  CXX="g++ -m64" \
  ./configure LDFLAGS="-L/c/Progra~1/JAGS/JAGS-4.2.0/x64/bin" \
  CXXFLAGS="-I/c/Progra~1/JAGS/JAGS-4.2.0/include" &&
  make win64-install && \
  make clean