Questions tagged [jags]

"JAGS is Just Another Gibbs Sampler. It is a program for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation not wholly unlike BUGS." (http://mcmc-jags.sourceforge.net/)

Filter by
Sorted by
Tagged with
6 votes
1 answer
6k views

Prediction based on bayesian model

I have created a bayesian model that estimates 6 parameters using rjags from R. Now i want to do some predictions based on new data in R. Can anyone help me with an example. ...
Abdelouahed BEN MHAMED's user avatar
1 vote
1 answer
2k views

My MCMC do not overlap : Mixturemodel with JAGS and R

I fitted a JAGS model and I have those results : My questions are: Why do my chains not overlap, and how can I fix that? I used the following method: My model is a mixture Gaussian model of two ...
Alex's user avatar
  • 43
9 votes
1 answer
2k views

When making inferences about group means, are credible Intervals sensitive to within-subject variance while confidence intervals are not?

This is a spin off of this question: How to compare two groups with multiple measurements for each individual with R? In the answers there (if I understood correctly) I learned that within-subject ...
Flask's user avatar
  • 1,931
2 votes
1 answer
2k views

Bayesian errors-in-variables model definition in JAGS and symbolically

I'm fairly new to probability theory and am attempting to understand and implement an errors-in-variables simple linear regression model. I am assuming a model of the form $$ Y=\theta X_a+\epsilon_Y ...
Aorus's user avatar
  • 85
32 votes
1 answer
7k views

For which distributions are the parameterizations in BUGS and R different?

I have found some distributions for which BUGS and R have different parameterizations: Normal, log-Normal, and Weibull. For each of these, I gather that the second parameter used by R needs to be ...
David LeBauer's user avatar
10 votes
1 answer
6k views

Missing values in response variable in JAGS

Gelman & Hill (2006) say: In Bugs, missing outcomes in a regression can be handled easily by simply including the data vector, NA’s and all. Bugs explicitly models the outcome variable, and ...
Jack Tanner's user avatar
  • 4,762
2 votes
1 answer
2k views

DIC, WAIC in JAGS

I have a Bayesian Hierarchical model using JAGS. In order to find the best model, I have compared the DIC of two models but It's not reliable. So, I decided to calculate WAIC from JAGS. However I have ...
Sirvan's user avatar
  • 23
1 vote
2 answers
2k views

What is the distribution of the ratio of two normals?

I need to use the ratio of two variables as the dependent variable in a regression. Both variables are normally distributed but with positive values. I can either center them or use as it is. If I ...
George Michaelides's user avatar
0 votes
2 answers
1k views

Comparing a model with two rate parameters to a model with one. Conjugate priors?

I have a model which includes two exponential rate parameters. I would like to test whether a model with two individual rates describes some data better than a model for which both rates are the same. ...
Jan Tünnermann's user avatar
19 votes
1 answer
7k views

Regularized bayesian logistic regression in JAGS

There are several math-heavy papers that describe the Bayesian Lasso, but I want tested, correct JAGS code that I can use. Could someone post sample BUGS / JAGS code that implements regularized ...
Jack Tanner's user avatar
  • 4,762
15 votes
2 answers
8k views

How can I model a proportion with BUGS/JAGS/STAN?

I am trying to build a model where the response is a proportion (it is actually the share of votes a party gets in constituencies). Its distribution is not normal, so I decided to model it with a beta ...
Joël's user avatar
  • 173
12 votes
2 answers
6k views

How can I set up a zero-inflated poisson in JAGS?

I am trying to set up a zero-inflated poisson model in R and JAGS. I am new to JAGS and I need some guidance on how to do that. I've been trying with the following where y[i] is the observed ...
George Michaelides's user avatar
7 votes
6 answers
3k views

R2jags does not remove the burn in part sometimes?

I found out that the function jags() in the R2jags package sometimes does not remove the burn in part even with the option ...
Baoyue Li's user avatar
  • 133
6 votes
1 answer
4k views

Combining posterior distributions

I have 5 different posterior distributions (mcmc samples) which all estimate the same parameter beta. The 5 models are all obtained from 5 independent standardized datasets but estimate the same ...
Achaz's user avatar
  • 169
46 votes
4 answers
9k views

OpenBugs vs. JAGS

I am about to try out a BUGS style environment for estimating Bayesian models. Are there any important advantages to consider in choosing between OpenBugs or JAGS? Is one likely to replace the other ...
DanB's user avatar
  • 938
22 votes
2 answers
9k views

Parameters without defined priors in Stan

I've just started to learn to use Stan and rstan. Unless I've always been confused about how JAGS/BUGS worked, I thought you always had to define a prior ...
JoFrhwld's user avatar
  • 2,397
21 votes
2 answers
9k views

What prior distributions could/should be used for the variance in a hierarchical bayesisan model when the mean variance is of interest?

In his widely cited paper Prior distributions for variance parameters in hierarchical models (916 citation so far on Google Scholar) Gelman proposes that good non-informative prior distributions for ...
Rasmus Bååth's user avatar
13 votes
1 answer
3k views

Managing high autocorrelation in MCMC

I'm building a rather complex hierarchical Bayesian model for a meta-analysis using R and JAGS. Simplifying a bit, the two key levels of the model have $$ y_{ij} = \alpha_j + \epsilon_i$$ $$\alpha_j =...
Dan Hicks's user avatar
  • 782
13 votes
1 answer
7k views

How to generate predictions with rjags?

I've used rjags to run MCMC on a model, specified in the JAGS language. Is there a good way to extract that model and perform predictions with it (using the posterior distributions of my parameters)? ...
Quantitative Historian's user avatar
12 votes
3 answers
4k views

Weighted generalized regression in BUGS, JAGS

In R we can "prior weight" a glm regression via the weights parameter. For example: ...
user28937's user avatar
  • 141
9 votes
1 answer
649 views

How many sides does a die have? Bayesian inference in JAGS

Problem I would like to do some inference on a system analogous to die with an unknown number of sides. The die is rolled several times, after which I would like to infer a probability distribution ...
davipatti's user avatar
  • 203
8 votes
1 answer
6k views

Ordered logit in JAGS

I am trying to code a simple model with JAGS: ...
teucer's user avatar
  • 2,031
8 votes
1 answer
6k views

Specify a Zero-inflated (Hurdle) Gamma Model in JAGS/BUGS

I'm trying to use a zero-inflated gamma model (or a gamma 'hurdle' model). The model is a mixture of logistic regression and generalized linear modeling. I can do this analysis in two steps: 1) do a ...
Nate's user avatar
  • 808
8 votes
1 answer
864 views

What level to use when comparing subjects in a hierarchical Bayesian analysis?

Say that I have an experiment where I test the reaction time of a number of subjects where each subject makes many reaction time trials. In a Bayesian framework the reaction times ($y$) could be ...
Rasmus Bååth's user avatar
8 votes
0 answers
3k views

Hyper-prior for negative binomial in hierarchical model using JAGS/BUGS

Below I'm using a negative binomial because it is more flexible than a simple poisson model. The data are counts $y$ of events for 16 individuals $x$. There are 14 counts (i.e. counting periods) for ...
user12719's user avatar
  • 1,079
8 votes
2 answers
8k views

How to use the SD of a normal sampling distribution to specify the gamma prior for the corresponding precision?

The gamma distribution is a commonly used prior distribution for the precision ($1/sd^2$) of a normal distribution in Bayesian hierarchical modeling. I want to use an informed prior for the variance ...
Rasmus Bååth's user avatar
7 votes
1 answer
3k views

Bayesian mixed model regression with a between subjects factor

I'm trying to specify a model in JAGS/rjags with one between subjects factor (a, with two levels - Y, N) interacting with one repeated measures continuous variable x plus subject varying slopes and ...
Matt Albrecht's user avatar
7 votes
2 answers
921 views

Appropriate GLM when response variable is proportion, but not binomial

The response variable I'm dealing with is the proportion of a total area that is suitable habitat for a species of interest. So although the response variable is bounded between 0 and 1, my intuition ...
Dalton Hance's user avatar
  • 1,137
7 votes
1 answer
6k views

How do I parameterize a Weibull distribution in JAGS / BUGS?

Based on the answer to a previous question, For which distributions are the parameterizations in BUGS and R different? I have been transforming R parameterizations to JAGS parameterizations, but I ...
David LeBauer's user avatar
5 votes
1 answer
1k views

JAGS, cannot evaluate upper index of counter [closed]

I asked this question at the JAGS sourceforge help forum but didn't get response there. I have the following JAGS model: ...
qkhhly's user avatar
  • 507
5 votes
1 answer
348 views

Difficulties with a Bayesian formulation of a model for human timing data

The Wing-Kristofferson model is a simple model of the behavior of a human trying to drum out a steady beat (that is, trying to mimic a metronome). Let $y_i$ be the $i$th interval between two drum ...
Rasmus Bååth's user avatar
4 votes
2 answers
1k views

Bounds on correlation to ensure covariance matrix is positive definite

UPDATED: I am constructing a correlation matrix for an MA(1) process, which would look something like... $$ C = \left( \begin{array}{cccccccccccccccccc} 1 & \rho & 0 & 0 & 0 & 0 &...
user13317's user avatar
  • 665
4 votes
1 answer
3k views

How to implement credible 95% interval for median odds ratio using JAGS?

As described in Merlo et al (J Epidem Comm Health 2006), the 95% credible interval for MOR is calculated using MCMC. MOR is defined as $\exp(\sqrt{2\sigma^2}\times 0.675)$, where $\sigma$ is the level-...
Omar's user avatar
  • 41
3 votes
1 answer
123 views

Books on Bayesian inferential analysis of GARCH models

Do you know books about Bayesian inferential analysis of GARCH models with the analysis of these models in R and JAGS? Here is a list of the books I already have: [Ardia] - Financial Risk Management ...
Mike9's user avatar
  • 97
3 votes
0 answers
3k views

Using JAGS for bayesian parameter estimation

I am using JAGS in R to construct a probabilistic graph model and estimate the corresponding parameters. The models is described as follows: ...
Yufei's user avatar
  • 31
3 votes
1 answer
1k views

error in JAGS beta-regression model R - value out of range in 'gammafn'

I am running a simple beta regression model in JAGS, following the example given here. Here is my JAGS model code as an R object: ...
colin's user avatar
  • 1,172
2 votes
1 answer
1k views

coding a JAGS error model for a dependent variable that has increasing variance as a function of the magnitude of the dependent variable

I am running a model in JAGS. I have a situation where y is a linear function of x, but the error in ...
colin's user avatar
  • 1,172
2 votes
1 answer
677 views

Random effect on scale parameter

I am trying to use random effects on both the location and scale parameters in a lognormal regression. As you can see in the JAGS code below, I am essentially fitting a accelerated failure time model ...
scottyaz's user avatar
  • 709
2 votes
0 answers
594 views

Convergence check in MCMC chains in R

I use Gelman-Rubin statistics, trace plots, autocorrelation plots and effective sample size to check the convergence. However, I got very different results from the above tests. The Gelman-Rubin ...
Suki Hao's user avatar
1 vote
1 answer
2k views

Binomial coefficient in JAGS

I'm trying to write such likelihood using JAGS in R (in order to estimate parameters $\xi$ and $\pi$, being $m$ fixed equal 7) using the "ones trick" and got stuck ...
user27115's user avatar
  • 125
1 vote
1 answer
377 views

Error metric for cross-validation on interval-censored data?

I want to compare crossvalidated model fit (of two Bayesian models, one using a normal distribution and the other a t-distribution) on interval-censored data - data where the exact point is not known, ...
gwern's user avatar
  • 415
1 vote
1 answer
645 views

JAGS burn-in phase takes ZERO time? [duplicate]

My breath was taken away by this. I tried to run my JAGS model with different number burn-in samples but it still takes the same amout of time!! ...
Tomas's user avatar
  • 6,133
0 votes
1 answer
346 views

Can I use beta priors in zero inflated poisson model?

Please I have a two fold questions and I am not sure how to phrase the title of my post to capture both. I am trying to fit a regression model in jags, and I am new Bayesian modeling. In my model I ...
new_student's user avatar