Questions tagged [jags]

a cross-platform Gibbs sampler similar to BUGS for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo simulation.

A cross-platform Gibbs sampler similar to BUGS for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo simulation.

Available at http://mcmc-jags.sourceforge.net.

472 questions
6
votes
3 answers

Defining new functions and distributions in the BUGS/JAGS/STAN language

I am very new statistical analysis world and have taken a recent interest in the BUGS/JAGS/STAN modelling language. Something which really surprises me is that I haven't seen any examples of new functions or distributions being defined to avoid code…
jacky
6
votes
3 answers

How to implement parallel jags on Windows with foreach?

I would like to run jags models in parallel on my windows computer with 4 cores, but have not been able to figure out why my model will not run. I have searched the web extensively including these…
Jesse
  • 121
  • 1
  • 6
5
votes
2 answers

Apply a Bayesian model (JAGS) for various iterations

Consider the following data frame: set.seed(5678) sub_df<- data.frame(clustersize= rep(1, 4), lepsp= c("A", "B", "C", "D"), dens= round(runif(4, c(0, 1)), 3), db= sample(1:10, 4, replace=TRUE)) Let's say I…
Danielle
  • 785
  • 7
  • 15
5
votes
0 answers

Dimension mismatch when initalizing an array (JAGS)

Wondering if any of you know why JAGS would tell me there was a dimension mismatch with my initial values here. I am attempting to fit a spatially explicit capture-recapture model in which I estimate a fish location (x,y) at each time step. There…
5
votes
0 answers

How to indicate an observation is the larger of two sampled values?

I'm writing a JAGS script (hierarchical bayesian model) where the times of events are modelled as a race between two processes. Observations: time is the measured times of events. Model: two processes with gaussian rates - whichever process…
Sanjay Manohar
  • 6,920
  • 3
  • 35
  • 58
5
votes
1 answer

Differences between rjags and r2jags

I use both packages in order to do Bayesian analysis but there are some differences that I don't understand: First of all the package rjags allows the adaptation phase, with the jags.model function, while the package r2jags does not have this phase,…
zick094
  • 63
  • 1
  • 5
5
votes
2 answers

extending burn-in period after JAGS model has been run in runjags for R

The runjags package for R is fantastic. The parallel capabilities and the ability to use the extend.jags function make my life so much better. However, sometimes, after I run a model, I realize the burn-in phase should be have been longer. How can I…
colin
  • 2,606
  • 4
  • 27
  • 57
5
votes
1 answer

How to predict values using estimates from rjags / JAGS

After setting up the model and training it with Gibbs Sampling, I got the result of all the prediction of hidden values with: jags <- jags.model('example.bug', data = data, n.chains = 4, n.adapt =…
user4462740
5
votes
1 answer

Cannot insert node into ...[]. Dimension mismatch

I'm trying to replicate simulations with a piece of jags code by Mark the Ballot, but jags is sending me an error message.. If I understood it correctly, it should have a problem with indexing house effects for each party somewhere, but I'm unable…
Marie-Eve
  • 565
  • 4
  • 15
5
votes
3 answers

Installation of package ‘rjags’ had non-zero exit status

S.O.: Linux Ubuntu 14.04 LTS R: R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-bit) When I try to install the package rjags, I get the following…
5
votes
1 answer

Step by step right-censored survival analysis in JAGS

This is a sort of follow-up to an earlier post on SE: https://stats.stackexchange.com/questions/70858/right-censored-survival-fit-with-jags But here, I would like to see a FULL R script (from start to finish) running a survival analysis on…
PendaFisi
  • 77
  • 5
5
votes
3 answers

Mixed Pareto and Normal Stan model not working

I'm trying to learn Stan via rstan (since I'm familiar with R). I've tried running a simple mixed Pareto and Normal model. It compiles fine (as far as I can tell), but it fails to sample, giving me the error: "Initialization between (-2, 2) failed…
ASGR
  • 86
  • 3
5
votes
2 answers

jags.parallel - Error in get(name, envir = envir) : invalid first argument

When using jags.parallel, I get the following error: > out <- jags.parallel(win.data, inits, params, "Poisson.OD.t.test.txt", + nc, ni, nb, nt); Error in get(name, envir = envir) : invalid first argument The same call using jags function runs OK. I…
Tomas
  • 57,621
  • 49
  • 238
  • 373
4
votes
1 answer

Error: package or namespace load failed for 'rjags'

In one of my conda environments in terminal, I am able to successfully install the package 'rjags'. However, when I run R within that environment and run library(rjags), I get the following error: Loading required package: coda Error: package or…
merryberry
  • 91
  • 1
  • 9
4
votes
2 answers

Using JAGS or STAN when an observed node is the max of latent nodes

I have the following latent variable model: Person j has two latent variables, Xj1 and Xj2. The only thing we get to observe is their maximum, Yj = max(Xj1, Xj2). The latent variables are bivariate normal; they each have mean mu, variance sigma2,…
Dagremu
  • 325
  • 1
  • 7
1
2
3
31 32