Questions tagged [r2jags]

R2Jags is an R package that interfaces with the JAGS Gibbs sampler.

Information and Downloads:

depends on another package, .

95 questions
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

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
3 answers

JAGS - hierarchical model comparison not jumping between models even with pseudopriors

I'm using the hierarchical modelling framework described by Kruschke to set up a comparison between two models in JAGS. The idea in this framework is to run and compare multiple versions of a model, by specifying each version as one level of a…
Tim
  • 69
  • 6
4
votes
1 answer

Error in vector("list", n.chains) : invalid 'length' argument

I am using R2jags and CODA to produce some diagnostic statistics to my MCMC chains, but I am having trouble. I want to run MCMC as follows: modelfit <- jags(data=jags.data, inits=jags.inits, model.params, n.iter = 100000, …
Camila Mendes
  • 107
  • 2
  • 6
4
votes
1 answer

strange jags.parallel error / avoiding lazy evaluation in function call

I have a function call (to jags.parallel) that works when given a numerical argument like n.iter = 100 but fails when the argument uses a variable value, n.iter = n.iter. This looks like it might be a bug in jags.parallel A minimal reproducible…
cboettig
  • 12,377
  • 13
  • 70
  • 113
3
votes
2 answers

Why is the model output from a fit with rjags and R2Jags different?

I'm working on fitting a multi-level logistic regression model with group level predictors. I am using JAGS via R. I am getting different behaviors when I fit the model with the runjags versus the R2Jags packages. I've tried to write a reproducible…
gregor-fausto
  • 435
  • 2
  • 9
3
votes
0 answers

Error Message Slicer stuck at value with infinite density

I am still green in handling Bayesian methods. In a bit to run Bayesian Analysis with a random effect on a real data , I encountered the following error "slicker stuck at value with infinite density", I tried altering the starting values of the…
mymymine
  • 49
  • 7
3
votes
1 answer

How to fix 'Node inconsistent with parents' in R2jags::jags

I am working with the R-package R2jags. After running the code I attach below, R produced the error message: "Node inconsistent with parents". I tried to solve it. However, the error message persists. The variables I am using are: i) "Adop": a 0-1…
Student1981
  • 319
  • 1
  • 8
3
votes
2 answers

How can I set a random seed using the jags() function?

Each time I run my JAGS model using the jags() function, I get very different values of fitted parameters. However, I want other people to reproduce my results. I tried to add set.seed(123), but it didn't help. This link describes how to achieve my…
ramund
  • 185
  • 11
3
votes
4 answers

Using jags.parallel from within a function (R language Error in get(name, envir = envir) : object 'y' not found)

Using jags.parallel from the command line or a script works fine. I can run this modified example from http://www.inside-r.org/packages/cran/R2jags/docs/jags just fine # An example model file is given in: model.file <-…
goryh
  • 215
  • 1
  • 4
  • 14
3
votes
0 answers

Logical test for R's NA in JAGS

What is the jags equivalent of R's is.na()? I am using r2jags to pass R data objects to jags, and in my jags model, I want to test if an element of a vector contains the equivalent of R's NA value. I don't know what jags "sees" when R says an…
rbatt
  • 4,677
  • 4
  • 23
  • 41
3
votes
1 answer

Can we get the residuals from JAGS output?

Say we fit a Bayesian linear mixed model using JAGS (or WinBUGS), does the output object include the model residuals? How can we find the residuals? Thanks!
askming
  • 925
  • 1
  • 6
  • 8
3
votes
2 answers

How many iterations are saved by JAGS/BUGS when burnin and thinning are specified?

I have a quick question about the details of running a model in JAGS and BUGS. Say I run a model with n.burnin=5000, n.iter=5000 and thin=2. Does this mean that the program will: Run 5,000 iterations, and discard results; and then Run another…
user1375871
  • 1,199
  • 1
  • 12
  • 23
2
votes
1 answer

Load JAGS to cluster

I would like to install jagsUI on the cluster that I am using. However, this requires me to load JAGS4.3.0 module which I have installed on my computer. This is the error I get when installing jagsUI: During startup - Warning message: Setting…
username97
  • 103
  • 6
2
votes
1 answer

"non-conforming parameters in function :" in simple linear regression using JAGS

I am super new to JAGS and Bayesian statistics, and have simply been trying to follow the Chapter 22 on Bayesian statistics in Crawley's 2nd Edition R Book. I copy the code down exactly as it appears in the book for the simple linear model: growth =…
sebzee
  • 35
  • 5
1
2 3 4 5 6 7