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/)

288 questions
44
votes
4 answers

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 in the foreseeable future? I will be using the…
DanB
  • 898
  • 8
  • 13
31
votes
1 answer

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 inverse transformed (1/parameter) before being used…
David LeBauer
  • 7,060
  • 6
  • 44
  • 89
21
votes
2 answers

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 distribution of some kind for every parameter in the model to be drawn from. It appears that…
JoFrhwld
  • 2,247
  • 3
  • 20
  • 22
19
votes
2 answers

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 the variance in a hierarchical Bayesian model are…
Rasmus Bååth
  • 6,422
  • 34
  • 57
18
votes
1 answer

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 logistic regression? Any scheme (L1, L2, Elasticnet)…
Jack Tanner
  • 4,552
  • 3
  • 27
  • 39
14
votes
3 answers

Bayesian variable selection -- does it really work?

I thought I might toy with some Bayesian variable selection, following a nice blog post and the linked papers therein. I wrote a program in rjags (where I am quite a rookie) and fetched price data for Exxon Mobil, along with some things that are…
14
votes
2 answers

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 distribution. I also have several predictors.…
Joël
  • 163
  • 2
  • 8
13
votes
2 answers

MCMC converging to a single value?

I'm trying to fit a hierarchical model using jags, and the rjags package. My outcome variable is y, which is a sequence of bernoulli trials. I have 38 human subjects which are performing under two categories: P and M. Based on my analysis, every…
JoFrhwld
  • 2,247
  • 3
  • 20
  • 22
12
votes
2 answers

Censoring/Truncation in JAGS

I have a question on how to fit a censoring problem in JAGS. I observe a bivariate mixture normal where the X values have measurement error. I would like to model the true underlying 'means' of the observed censored values. \begin{align*} \lceil…
Glen
  • 6,320
  • 4
  • 37
  • 59
12
votes
2 answers

How do programs like BUGS/JAGS automatically determine conditional distributions for Gibbs sampling?

Seems like full conditionals are often quite difficult to derive, yet programs like JAGS and BUGS derive them automatically. Can someone explain how they algorithmically generate full conditionals for any arbitrary model specification?
user4733
  • 2,494
  • 2
  • 20
  • 31
12
votes
3 answers

Weighted generalized regression in BUGS, JAGS

In R we can "prior weight" a glm regression via the weights parameter. For example: glm.D93 <- glm(counts ~ outcome + treatment, family = poisson(), weights=w) How can this be accomplished in a JAGS or BUGS model? I found some paper discussing…
12
votes
1 answer

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)? I can re-specify the model in R and plug in the…
12
votes
1 answer

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 = \sum_h \gamma_{h(j)} + \epsilon_j$$ where…
12
votes
2 answers

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 variable model { for (i in 1:I) { y.null[i] <- 0 …
George Michaelides
  • 1,039
  • 1
  • 9
  • 19
11
votes
4 answers

Vector multiplication in BUGS and JAGS

In R, c(3,1,0) * c(2,0,1) == c(6,0,0). This is not dot product and it's not cross product. First, what is the name for this product, and second, does it work in WinBUGS, OpenBUGS and/or JAGS?
Jack Tanner
  • 4,552
  • 3
  • 27
  • 39
1
2 3
19 20