Sunday, May 7, 2017

Using rjags and rstan in Ubuntu

Doing Bayesian data analysis you probably will need to use JAGS and/or STAN to proceed MCMC in R. These can be done using packages rjas and rstan. If you are using Linux (Ubuntu) you can follow the instructions below:

Install Jags in Ubuntu
(open terminal)

sudo add-apt-repository ppa:marutter/rrutter
sudo apt-get update
sudo apt-get install r-cran-rjags

more details on

Install Stan in Ubuntu
(open terminal)

sudo apt-get install r-cran-rcpp r-cran-inline r-cran-rcpp
options(repos = c(getOption("repos"), rstan = ""))
install.packages('rstan', type = 'source')install.packages('rstan', type = 'source')
install.packages('rstan', type = 'source')

Check the installation
> fx  <-  inline::cxxfunction( signature(x = "integer", y = "numeric" ) , 'return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;' )
> fx( 2L, 5 ) # should be 10

more details on

No comments:

Post a Comment