Questions tagged [r2jags]

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

Information and Downloads:

depends on another package, .

95 questions
0
votes
1 answer

I can't see model results in R2jags - what is wrong?

I'm trying to run this script in R2jags following the instructions provided in "Lahoz-Monfort JJ, Guillera-Arroita G, Tingley R (2015) Statistical approaches to account for false positive errors in environmental DNA samples. Molecular Ecology…
0
votes
1 answer

Error in jags.model RUNTIME ERROR: Compilation error on line 5. Index out of range taking subset of a

I'm quite new to Jags, I'm trying to calculate the model DIC but returned with such error: Error in jags.model(model.file, data = data, inits = init.values, n.chains = n.chains, : RUNTIME ERROR: Compilation error on line 5. Index out of range…
kulala
  • 39
  • 1
  • 6
0
votes
1 answer

"convergence" for a derived quantity in JAGS/R2Jags

UPDATE: Now with Traceplot example UPDATE: Now with new traceplot I am trying to adapt Outhwaite et. als 2018 code for occupancy modelling and have a couple of questions that I just can't seem to find an answer for... Code used to create…
Gmichael
  • 526
  • 1
  • 5
  • 16
0
votes
3 answers

RUNTIME ERROR: Index out of range taking subset of theta

I have a data frame that looks like this: y s 1 cat 0 cat 0 dog 0 dog 0 dog 0 dog 0 dog 0 dog 0 dog 1 dog 1 cat 0 dog 0 dog 1 dog 0 dog 1 dog 0 dog 0 dog 0 dog 0 dog 0 dog 0 dog 1 cat 1 dog 0 cat 1…
0
votes
1 answer

How to check for convergence in JAGS

I've estimated a huge and complex time-varying hierarchical model in JAGS for time series of hundreds of individuals. I estimate time-varying parameters for individuals leading to 80 parameters per person. The parameters are random effects that…
0
votes
1 answer

slicing a vector shows error our of range

I have this part of my jags code. I really can't see where the code gets out of the range. Can anyone please see any error that I can't recognize? These are the data sizes. N = 96 L = c(4,4,4,4,4) length(media1) = 96 length(weights1) = 4 …
0
votes
1 answer

How to make a variable in the function equal to the sum of that variable in previous trials in jags

In my model, I have 10 options (from 1-10) for each subject and each trial to choose (expectancy). I calculated the value for each option based on the rule in the graph below, so the value for each option updated based on the difference between…
Kenny
  • 361
  • 1
  • 8
0
votes
0 answers

How to avoid overdispersed Poisson regression overfitting?

I have a dataset including three variables including company id (there are 96 companies), expert id (there are 38 experts) and points given by experts to companies. Points are discrete values from 0 to 100. I tried fitting an overdispersed poisson…
Amin Shn
  • 532
  • 2
  • 11
0
votes
0 answers

Predict values from complex Rjags model

It's the first time I'm working with R2Jags, MCM chains and Bayesian models and I'm having trouble to compute the predicted values for my model. The model is based on research by Hallmann et al. 2017…
L.Thoma
  • 23
  • 6
0
votes
0 answers

I'm trying to parallelize MCMC using R2Jags in R and need help solving this error

I want to use the R2Jags parallel model (jags.parallel) to speed up my computations. The documentation states I need to recompile the model before updating it. However I get a clear error that I don't know how to handle. Error message: Code that…
0
votes
1 answer

Non-conforming parameters in function inprod

all, I'm trying to use JAGS model in R. The R package is "R2jags". I'm confused with the error like beblow. Compiling model graph Resolving undeclared variables Allocating nodes Deleting model Error in jags.model(model.file, data = data, inits =…
0
votes
1 answer

Converting a R2jags object into a Stanreg (rstanarm) object

I made a model using R2jags. I like the jags syntax but I find the output produced by R2jags not easy to use. I recently read about the rstanarm package. It has many useful functions and is well supported by the tidybayes and bayesplot packages for…
Junitar
  • 905
  • 6
  • 13
0
votes
0 answers

Running R function jags on cluster

I am trying to run a R program on cluster. In the R program,jags function is called from the package R2jags. If I don't use the cluster and simply use R, then the program works fine. However, when I try to submit a job, then I get the following…
Hello
  • 61
  • 1
  • 9
0
votes
0 answers

JAGS not recognizing values stored in R's global environment

I'm running JAGS with R v3.6.1 and Rstudio v1.2 in Windows 10, using package R2jags. JAGS does not appear to find the stored values that I've created in R for MCMC settings such as n.iter, n.burn-in, etc. because my code: out2 <- jags.parallel…
jj1995
  • 1
0
votes
0 answers

Setting up a hierarchical model using R2jags

I'm working on a project for an introductory Bayesian analysis course and I'm also fairly new to using R regularly. We are supposed to build a hierarchical model using a data set we found or put together. I put a data set together to analyze the…
whgonzalez
  • 15
  • 4