Questions tagged [runjags]

runjags: Interface Utilities, Model Templates, Parallel Computing Methods and Additional Distributions for MCMC Models in JAGS

User-friendly interface utilities for MCMC models via Just Another Gibbs Sampler (JAGS), facilitating the use of parallel (or distributed) processors for multiple chains, automated control of convergence and sample length diagnostics, and evaluation of the performance of a model using drop-k validation or against simulated data. Template model specifications can be generated using a standard lme4-style formula interface to assist users less familiar with the BUGS syntax. A JAGS extension module provides additional distributions including the Pareto family of distributions, the DuMouchel prior and the half-Cauchy prior.

51 questions
1
vote
0 answers

Convergence diagnostic with Gelman-Rubin PSRF: R coda package vs Runjags

I run Bayesian models with Runjags and then convert the output in MCMC.list with the coda package. I check convergence with the Gelman-Rubin diagnostic (univariate). Sometimes, the PSRF is large just because a chain sampled a large value at some…
1
vote
1 answer

RUNJAGS-set seed without prior for simulations

I am sampling some data from a normal distribution using runjags. I don't have any prior for the parameters that I used for my simulations. It seems that runjages dos not use the argument to fix the seed: list(".RNG.name"="base::Super-Duper",…
Nicolas
  • 105
  • 2
  • 9
1
vote
1 answer

Inserting jagam code into runjags (JAGS) model

I’ve been trying to incorporate smoothing into a runjags model that I’ve created to model seabird burrow numbers and distribution across an island. I’ve managed to generate some smoothing code by extracting the count data and x and y coordinates…
Bong112
  • 161
  • 10
1
vote
0 answers

trouble fitting a dirlichet model to simulated data in JAGS, implemented in R (beta works)

Lets say I have some data on the relative abundance of 3 species. Species 1 has a negative relationship with mean annual temperature (mat). Relative abundance data are stored in the matrix, r.spp.y: #Simulate some species count data. y1 <-…
colin
  • 2,606
  • 4
  • 27
  • 57
1
vote
1 answer

trimming mcmc.list in jags / rjags / runjags

I have the output of a runjags model in R as an mcmc.list. Below is code to generate 3 chains of 1,000 samples. I'd like to trim all 12 chains to the last 400 samples. I can pull apart the chains and save matrices of chain output in a list, but its…
colin
  • 2,606
  • 4
  • 27
  • 57
1
vote
1 answer

specifying a hierarchical model in JAGS for R

I have data on some dependent varaible y that can be modeled as a function of covariates x1 and x2. y and x1 are observed at the "plot" level, and and x2 is observed at the "site" level. Plot is nested within site, hierarchically. Here are 100…
colin
  • 2,606
  • 4
  • 27
  • 57
1
vote
1 answer

Remove a chain from a runjags object in R

I have a runjags object that has two chains that mixed very well (chains 1 and 3), and one that did not (chain 2). How can I go about trimming the runjags object to just contain chains 1 and 3? Here is a reproducible example of generating a JAGS…
colin
  • 2,606
  • 4
  • 27
  • 57
1
vote
1 answer

Error in jags.model

I'm new to R and JAGS, and not even very experienced with programming. I'm trying to set up a hierarchical model for some data, but I get this error: ####error in line above: Error in jags.model(file = "modelControl.txt", data = dataList, inits =…
Jeroen
  • 79
  • 1
  • 9
1
vote
1 answer

Convert multilevel jags model from wide to long format

I have a multi-level jags model. I'm trying to convert it from wide to long format as described here: http://jeromyanglim.tumblr.com/post/37361593128/jags-converting-multilevel-model-from-wide-to However my model is more complex than the example so…
user2498193
  • 1,072
  • 2
  • 13
  • 32
1
vote
0 answers

Spline in JAGS mixing badly

I have a model that calculates a spline for Mark-recapture data with survival data. The model is working fine, but the parameters that calculates the spline are mixing super badly. mean 2.5% 97.5% That…
M. Beausoleil
  • 3,141
  • 6
  • 29
  • 61
1
vote
0 answers

directed cycle error in JAGS when making multiple predictions

I use my JAGS model, and then use that model to make predictions, propogating parameter uncertainty into those predictions. I currently have a zero-inflated Poisson (ZIP) model that runs fine making a single prediction. It looks like this: j.model…
colin
  • 2,606
  • 4
  • 27
  • 57
1
vote
1 answer

Logistic regression with categorical predictors using JAGS

I'm new to JAGS and I'm trying to predict a binary outcome (0/1) using 9 non-continuous predictors. Predictor values may be 0, 1 or 2. This is my first time doing this, and even though I can get the model to run, I am 100% sure there's definitely a…
Guilherme D. Garcia
  • 179
  • 1
  • 3
  • 11
1
vote
1 answer

unused variable(s) warning in runjags model

I am running JAGS models through the R package runjags. I just updated to JAGS 4.0.0 from JAGS 3.4, and have noticed some unexpected behavior that seems to be related to the update. First, when I run a model, I now get a warning message WARNING:…
1
vote
1 answer

Adding/removing summaries/plots requires re-compilation of runjags object

Since runjags object with all plots is too big, I tried to run.jags with plot=FALSE, save the resultant runjags object into file, restore it in new R session (as out) and then generate the plots by out.with_summaries <- extend.jags(out, sample = 0,…
Tomas
  • 57,621
  • 49
  • 238
  • 373
1
vote
1 answer

Runjags - how to let JAGS decide on the adaptation phase?

I am using run.jags function of the Runjags package. The problem is that run.jags forces adaptation phase even for models that don't need it. I want to let JAGS itself to decide on the necessity and the default length of adaptation phase (some…
Tomas
  • 57,621
  • 49
  • 238
  • 373