Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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

257 questions
Filter by
Sorted by
Tagged with
2k views

### JAGS - problem with taking submatrices

I'm trying to use JAGS for clustering mixtures of multivariate normal distributions. In order to model different covariance structures in each cluster I wanted to use one big (C*D)xD matrix (C - ...
251 views

### Non-conventional form for a full conditional

I have a full-conditional of the form : $$p(X|...) \propto \exp(-(aX^2 +bX +c/X)),$$ All of the other full-conditionals of my model simplify to a simpler form and for a sake of simplicity, I would ...
5k 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 ...
3k views

### Compilation error in JAGS

With this data: ...
699 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 ...
1k views

### Hierarchical models for multiple comparisons - multiple outcomes context

I've just been (re-)reading Gelman's Why we (usually) don't have to worry about multiple comparisons. In particular the section "Multiple outcomes and other challenges" mentions using a hierarchical ...
6k 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 ...
3k views

### Code Problem in Lognormal Bayesian Model in JAGS/WinBUGS

I have a data set with 853 units. Below, a small sample of it: y ...
7k 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 ...
962 views

### ANOVA with uncertain values - attempt to redefine node

I'm trying to do one-way ANOVA on uncertain (latent) input value YReal[i] (each input value is not exactly known, but it is given as normal distribution with mean <...
455 views

### First iteration in MCMC coda chain is different from initial values

I have my jags output object. In order to understand how MCMC coda chains work, I tried to see if first iteration in each MCMC chain is equal to the initial values supplied. And it is different! The ...
267 views

### Crazy divergence in mixed model - chains start well but go crazy later

I'm trying to compute a mixed model using jags (R2jags) and I got very strange divergence. The chains started so well, very well according to the results expected (also see ...
2k views

### How to model data in jags/bugs generated by taking the minimum of two random variables?

I have been thinking of modeling human timing data using jags where the data comes from an experiment where participants tap in time with a very slow metronome. The data is then a number of ...
4k views

### jags missing data error

I am estimating a probit in jags on a time series cross sectional data set (country years) with 5 covariates, 4 of which are lagged, so the first observation for each country will be missing on those ...
5k 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 ...
740 views

### Generating and analyzing predicted data in JAGS

I am trying to model a logistic regression on data predicted from the results of a previous logistic regression, and am having trouble figuring out how to do it, either in OpenBUGS (BRugs) or JAGS (...
2k views

### How can I generate a plot similar to that produced by plot.bugs and plot.jags from an mcmc.list? [closed]

R seems to be able to output nice summary plots from the bugs and jags objects generated by the functions R2WinBUGS::bugs and ...
2k 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-...
687 views

### How to sample from the prior predictive distribution in jags? [closed]

Is there an example available of how I can sample from the prior predictive distribution (without data) in jags? I would like to get a better sense for the contribution of the prior in a multilevel ...
3k views

### Hierarchical multinomial logit with R/JAGS

I am working on a small project where I have to do a Choice Based Conjoint (CBC) analysis. In order to get the part-worths for the different consumers I need to estimate a hierarchical multinomial ...
3k views

### Calculate R-squared with JAGS and R

I have the following model that I am running in JAGS from R: ...
5k 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)? ...
2k views

### Tips and tricks for getting good parameter estimates using Bayesian nonlinear regression

I've been playing around with fitting nonlinear models using rjags. Specifically 3 and 4 parameter sigmoid curves, e.g., ...
3k views

### JAGS: unobserved parents and intialization

I have a very simple multinomial logistic regression problem; it's a simplified version of the alligator lake/food/size BUGS example. In my case I have (effectively) lake/food and have just stripped ...
5k 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 ...
2k 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 ...
3k views

### Problems of specifying constrained parameters in a hierarchical model under JAGS

I'm trying to fit a model under JAGS where I have a response, y, that depends linearly on eight predictors (with no intersect : I'm actually trying to evaluate the share of each socioeconomic statuts ...
868 views

### Fitting constrained hierarchical models in JAGS

I have been doing some research on constrained models and have recently read the paper: Gunn and Dunson (2005) "A Transformation Approach for Incorporating Monotone or Unimodel Constraints", ...
443 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 ...
746 views

### How do I specify priors for angle parameters in BUGS/JAGS? [closed]

I am writing a hierarchical BUGS model that involves both linear and angle variables. I want the hyper-parameters to be normally distributed, which is straight-forward for the linear variables, but I'...
5k 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 ...
3k views

### 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?
2k views

### Longitudinal models in R and WINBUGS or JAGS

I've tried to use R to fit some longitudinal models, mostly via lmer and nlme packages. However, it seems that many standard ...
3k views

### How to combine step(x) and dbern(p) in JAGS/WinBUGS?

The problem involves trying to characterize the probability: P.f = Pd*Pr{t1 < t2} using jags or WinBUGS. The issue is the last term where both t1 and t2 are ...
876 views

### Add new distribution to JAGS or OpenBUGS?

I would like model some variables using a distribution that is not neither JAGS' nor OpenBUGS core distributions. Do you know how can I implement it? Thanks.
183 views

### How to implement rounding in BUGS in a survey context?

In a traditional filtering context, you'd analyse polls coming in with something like ...
3k views

### Using dmnorm in JAGS

I have a question regarding the use of dmnorm in Jags when none of the mean and variance covariance matrix are known and fixed. I keep getting the error "node Q invalid parent value" I am not sure ...
4k 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 ...
767 views

### Truncating a posterior predictive distribution in JAGS

I have run into an error associated with truncating a distribution in JAGS. In my minimum reproducible example, I have data for 9 observations and would like to find a posterior predictive ...
516 views

### Data and model blocks in JAGS

I am trying to model a function of observed data in JAGS. For example x[i,t]/phi ~ dpois(mu) where x is observed and phi is a parameter in the model. I can't ...
1k views

### Quantile regression in JAGS

I am trying to implement a simple quantile regression in R using JAGS: ...
5k views

### Ordered logit in JAGS

I am trying to code a simple model with JAGS: ...
172 views

### How do I transform a data generation specification in R into a BUGS/JAGS specification

I am at a loss about what the BUGS/JAGS specification of the following should look like. The background is that one person has four measurements taken by four different instruments. Each instrument ...
4k 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 ...
1k views

### How to run JAGS as fast as possible on Mac? [closed]

I am running lots of simulations in JAGS 3.1.0 , which I have compiled from source. I am using a mid-2009 Macbook Pro 13 2.53GHz. Is there any step by step tutorial (from scratch) to compile ATLAS or ...
1k views

### A problem using Bayesian modeling to impute a variable measured with error

I'm trying to fit a basic measurement error model (from Wansbeek and Meijer pg. 191), using a Bayesian latent variable model. The model appear to converge, but on the wrong answer. I've tried all ...
709 views

### Scaling a distribution in JAGS

If I have the following model y~s*dist(a,b) where s is a constant and dist is a given ...
2k views

### How does dinterval() for interval censored data work in JAGS?

I am trying to understand how dinterval() works in JAGS for censored data. I am modeling coarse data where I only have upper and lower bounds for each data point (not the true value). Here is a ...