Questions tagged [r2jags]

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

Information and Downloads:

depends on another package, .

95 questions
2
votes
1 answer

How to deal with "Non-conforming parameters with inprod function" in JAGS model

I am trying to model the variance in overall species richness with the habitat covariates of a camera trapping station using R2jags. However, I keep getting the error: "Error in jags.model(model.file, data = data, inits = init.values, n.chains =…
M. Pretorius
  • 33
  • 1
  • 5
2
votes
1 answer

JAGS and R: Obtain posterior predictive distribution for specific x

I am trying to obtain a posterior predictive distribution for specified values of x from a simple linear regression in Jags. I could get the regression itself to work by adapting this example (from…
user214333
  • 23
  • 1
  • 3
2
votes
1 answer

Suppress JAGS "value out of range" warnings in R

I'm running a large number of JAGS models in R using the jags function of the R2jags package (which uses the rjags package to run JAGS). I get a lot of warnings printed in the console: value out of range in 'lgamma' Printing these warnings seems…
Scransom
  • 3,175
  • 3
  • 31
  • 51
2
votes
0 answers

Cannot load R2jags because rjags is not found

Cannot for the life of me get R2jags to run. I have tried all different versions of rjags, JAGS, R... each time I get the same error: .onLoad failed in loadNamespace() for 'rjags' All of the other files in the R2jags package loads just fine...
Lars Asph
  • 21
  • 5
2
votes
1 answer

How to interpret some syntax (n.adapt, update..) in jags?

I feel very confused with the following syntax in jags, for example, n.iter=100,000 thin=100 n.adapt=100 update(model,1000,progress.bar = "none") Currently I think n.adapt=100 means you set the first 100 draws as burn-in, n.iter=100,000 means the…
user5802211
  • 197
  • 1
  • 9
2
votes
0 answers

JAGS cannot handle small exponential value?

I had a weird problem using JAGS for Bayesian data analysis. Say in a loop, I have for (i in 1:10) { A[i] <- B[i]*exp(-C[i]) } whenever C[i] is large and results in exp(-C[i]) smaller than 10^-16, A[i] takes the value of A[i-1]. It looks like…
athlonshi
  • 1,711
  • 1
  • 19
  • 23
2
votes
1 answer

Fit a bayesian linear regression and predict unobservable values

I'd like to use Jags plus R to adjust a linear model with observable quantities, and make inference about unobservable ones. I found lots of example on the internet about how to adjust the model, but nothing on how to extrapolate its coefficients…
Marie-Eve
  • 565
  • 4
  • 15
2
votes
0 answers

Why the parameter estimation of my beta-binomial model using jags differ from maximum likelihood estimations

I have a beta-binomial model like this where $B$ is the beta function. I want to estimate the parameters $\theta_1,\theta_2,\ldots,\theta_5$. I used a Maximum likelihood method: BBlikelihood = function(theta){ k =…
Shima
  • 117
  • 1
  • 10
2
votes
1 answer

How can I integrate prior with data exactly?

I was told to use Bayesian inference instead of working only analytically with polling data. However, I have a problem; I have a small dataset with guesses about prior distributions for the parties, and I have data from polls. How can I obtain…
user3407340
  • 93
  • 1
  • 1
  • 4
2
votes
0 answers

2 Models in JAGS - kind of 'non-trivial' case

I am trying to build a GARCH(1,1) model in JAGS, and for simplicity let's assume that the mean equation follows the AR(1) process. I am trying to build 1 JAGS model that will allow joining the AR(1), and GARCH(1,1) processes. For now I can only…
Peter T251
  • 41
  • 3
1
vote
0 answers

updated Rstudio and R, now unable to install rjags

I just updated Rstudio (2023.03.0 Build 386) and R (R version 4.2.3 (2023-03-15 ucrt) -- "Shortstop Beagle"). I am trying to install rjags, R2jags, and simmR. Everything else is dependent on rjags. When intstalling rjags I get the error: Error:…
vermicellion
  • 338
  • 2
  • 14
1
vote
1 answer

Results different after latest JAGS update?

I am running Bayesian Hierarchical Modeling in R using R2jags. When I open code I used a month ago and run it on a dataset I used a month ago (verified by "date modified" in windows explorer), I get different results than I got a month ago. The only…
pakalla
  • 163
  • 4
  • 10
1
vote
0 answers

what is the reason to draw the scatterplot matrix for the mcmc sample?

I found some bayesian paper try to draw the scatter plot matrix for the parameters. I just wondering what is the goal to draw this scatter plot matrix? what is the meaning if I see some linear or nonlinear relationships between samples. Thanks
hard worker
  • 181
  • 8
1
vote
0 answers

why my trace plot looks like this for some parameters in Jags?

I am running a Hierarchical model one of the parameter's traceplot looks like this First question is that is it converge? Second question is that is it because the size of the data set is too small? I just have 8 data points third question is why…
hard worker
  • 181
  • 8
1
vote
0 answers

Autocorrelated error in zero-altered (hurdle) Poisson or negative binomial model (zero-inflation) using JAGS

I am using Bayesian zero-altered (hurdle) Poisson or negative binomial model using R2jags. Because the ACF of the Pearson residuals showed autocorrelation, I decided to apply autoregressive residual into the zero-altered model. However, I don't know…
YHH
  • 31
  • 2