First, clone the GOAL repository from GitHub:
git clone https://github.com/vinash85/GOAL.git
cd GOAL
First, install the GNU Scientific Library (GSL) using your system’s package manager:
sudo apt-get update
sudo apt-get install libgsl-dev
or
wget https://mirror.team-cymru.com/gnu/gsl/gsl-latest.tar.gz -O gsl-latest.tar.gz
tar -zxvf gsl-latest.tar.gz
cd gsl-*/
./configure
make
sudo make install
Download and install the ransampl
library:
wget https://sourceforge.net/projects/ransampl/files/latest/download -O ransampl-latest.tar.gz
tar -zxvf ransampl-1.0.tar.gz
cd ransampl-*/
./configure
make
sudo make install
Ensure that LAPACK and BLAS libraries are installed on your system:
sudo apt-get install liblapack-dev libblas-dev
Install the necessary R packages:
install.packages(c("BayesLogit", "Rcpp", "RcppArmadillo", "RcppProgress"))
If BayesLogit
is not available on CRAN, install it from GitHub:
install.packages("devtools")
devtools::install_github("jwindle/BayesLogit")
Before compiling GOAL, update the Makevars
file to include the paths to GSL and ransampl.
-
Navigate to the
src/
directory of the GOAL source code. -
Open
Makevars
and modify the following lines:PKG_CXXFLAGS = -fopenmp -I/usr/local/include -DUSE_R -DNDEBUG -DDISABLE_SINGLE -DNTHROW -DDISABLE_FIO PKG_LIBS = -L/usr/local/lib -lgsl -lgslcblas -lm -lransampl -fopenmp -lgomp -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
Note: If your libraries are installed in different locations, adjust the paths accordingly.
-
Navigate to the root directory of the GOAL package source code.
-
Run the installation command:
sudo R CMD INSTALL .
This will compile and install GOAL into the system-wide R library.
Open an R session and load the GOAL package to ensure it was installed correctly:
library(GOAL)
If the package loads without errors, the installation was successful.
- Missing Dependencies: Ensure all dependencies are installed and paths are correctly set.
- Linker Errors: Double-check the
Makevars
file for correct paths to GSL, ransampl, LAPACK, and BLAS. - Package Not Found: Verify that the package is installed in the correct R library path using
.libPaths()
.
For further assistance, please contact asahu@salud.unm.edu
To speed up the computation GOAL also uses openmp (http://openmp.org/wp/), however this is optional.