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/)
80
questions with no upvoted or accepted answers
9
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 ...
7
votes
0
answers
2k
views
Label Switching in WinBugs/JAGS
I am using JAGS to estimate a Dirichlet Process Mixture of Normals. The code works well and the estimated density is accurate. However, I would like to know which component each observation is ...
5
votes
0
answers
472
views
AR(1) model - which prior to use?
I want to use the following univariate model:
$y_t = \mu_t + \epsilon_t, \ \epsilon_t \sim N(0,1)$
$\mu_t = \phi \mu_{t-1} + \omega_t, \ \omega_t \sim N(0,\sigma_\omega^2)$
That is, $\mu_t$ follows ...
5
votes
0
answers
2k
views
CAR spatial models in JAGS
WinBUGS comes with the GeoBUGS add-on, which contains a number of predefined model structures that are suitable for modelling spatial data structures e.g. geostatical structures (spatial.exp), ...
3
votes
0
answers
506
views
How to specify a zero-inflated Dirichlet model in JAGS/BUGS
There was a recent publication discussing the advantages of the zero-inflated dirichlet for microbiome count data which is compositional (you are modeling a matrix of species relative abundance data ...
3
votes
0
answers
1k
views
How to specify the Bayesian version of a clustered-robust standard error OLS in BUGS/JAGS or Stan?
I am trying to reproduce a simple OLS model fitted with clustered-robust standard errors within the Bayesian framework (be it with BUGS/JaGS or with Stan).
In R, my frequentist model is the following:...
3
votes
0
answers
194
views
Why is this Bayesian estimate of a truncation-point so poor?
I have several datasets. Each dataset holds the masses of objects that have been subject to physical wear, expressed as a proportion of their original mass ($w$), and the amount of time that the ...
3
votes
0
answers
1k
views
R, JAGS and missing data
I am currently using JAGS via the program R to run N-mixture models using about 5 years of count data. In 3 of these years, there were 3 counts per site, while in the remaining 2 there were 2 counts ...
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:
...
3
votes
0
answers
463
views
A better bayesian way of modelling autoregressive mixtures
I have a JAGS hierarchical model which includes a temporal sub-model for the primary vote share between four party groups (LNP, Labor, Green, and Other). For each day in the temporal model, the vote ...
3
votes
0
answers
93
views
Coda output, joint quantile
I am running a hierarchical model in JAGS. It is a piecewise constant survival regression model.
So I have 4 sets of regression coefficients and baseline hazard rates.
I would like to plot a mean ...
2
votes
0
answers
118
views
Using discrete random variable as index in JAGS
I have a model that can be distilled into,
$$d \sim U(1,20)$$
$$Y_t \sim N(X_{t-d},\sigma^2)$$
for two time series that have observations from $Y_{1,..,t}$ and $X_{1,...,t}$.
I'm trying to code it up ...
2
votes
0
answers
151
views
Gibbs updating algorithm (Gibbs steps) for computationally expensive likelihood
I am looking for a good way to update steps in a Gibbs sampler where the likelihood function is computationally expensive. Here is what I tried so far:
By default JAGS uses a slice sampler. However, ...
2
votes
0
answers
92
views
Is there anything wrong with having a Bayesian logistic regression model with beta priors?
The Bayesian logistic regression model with beta priors seem to work using JAGS. I just can't find any examples of it in any literature or any tutorials. They all seem to use normal priors.
Just want ...
2
votes
1
answer
75
views
Help with Power Curve MCMC
I'm trying to analyze some $D$ non-logistic cumulative data in a time series, bounded below by 0 and unbounded above.
Splitting data into $W$ time windows of $d$ days, I know each window can be ...
2
votes
0
answers
613
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 ...
2
votes
0
answers
181
views
Bayesian model averaging with pseudopriors
I'm performing Bayesian model averaging (BMA) on 4 models describing the log-death rate. The four model are the Lee-Carter
$$\log m_x(t) = \alpha_x + \beta_x\kappa_t+\epsilon_{x,t},$$
the Renshaw-...
2
votes
0
answers
343
views
Standard Deviations of Random Effects
I would have a question regarding the estimates of the random effects for a model fitted with JAGS.
I want to fit a mixed model of the form:
$$y_{ij}=\beta_{0j}+\beta_{1j}x_{ij}+\beta_2+e_{ij}$$
$$\...
2
votes
0
answers
428
views
Comparing the Widths of two Posterior Distributions
I have a question regarding the task of my term paper case study, which is about Bayesian multilevel modelling and I would greatly appreciate it, if you could help me out.
The exact assignment reads ...
2
votes
0
answers
259
views
Meaning of Baseline Before Sum to Zero
I am trying to specify a Bayesian hierarchical split-plot model in JAGS. I have been following Doing Bayesian Data Analysis by John K. Kruschke, however the model I am attempting is not included in ...
2
votes
0
answers
1k
views
DIC vs PED in JAGS
JAGS allows reporting of DIC and also PED (penalized expected deviance). What are differences between these two statistics? Which is better for what purpose? DIC was the first one, PED was evidently ...
2
votes
0
answers
380
views
Diagonal inflated Bivariate Poisson model
I am trying to fit the Bivariate Poisson distribution to a set of sports results to serve as a comparison model to a new model I am developing/developed with my masters thesis.My model is as follow:
<...
2
votes
0
answers
576
views
Deviance n.eff in R becoming 1 at high sample n
I've been doing some basic bayesian t-tests in OpenBUGS, and later JAGS (via a friendly biometrician), and in both cases I ran into a bizarre property of the R-2- packages on the output. Specifically, ...
2
votes
0
answers
713
views
Discrete MCMC JAGS chains get stuck
I have been running a model where one of the parameters is discrete. I can't think of a simple way to represent this model, so I won't (unless necessary) post it here.
My issue is, that when I look ...
2
votes
0
answers
105
views
Hierarchical Bayesian model with heterogenous errors
I have an experiment where I repeatedly show subjects two lights, and I ask which light is brighter. I am interested in whether error rates decrease over time, holding all else constant.
I also ...
2
votes
0
answers
720
views
"Observed node inconsistent " when binomial success rate exactly one
I observed some curious behavior in JAGS (rjags). There probably is a good reason for it, but I can't figure it out:
As part of a more complex model I have these statements:
...
2
votes
0
answers
409
views
Estimating parameters and latent variables in a split Poisson distribution using R and JAGS
I am trying to estimate parameters and latent variables in a split Poisson model that describes observable and unobservable counts in time assuming the split probability is $\pi$. An observable event ...
2
votes
0
answers
2k
views
Dummy coding from a Bayesian point of view
If we want to use categorical variables in regression context, we are allowed
to use dummy codings such as these schemes.
Is this also required in a Bayesian (MCMC) context, such as with WinBUGS/...
2
votes
0
answers
2k
views
Within-subjects model in JAGS/stan
I have a general question regarding a varying intercept / varying slope model in jags/stan:
I have data from a psychophysics experiment, with one covariate, one within-subjects factor and several ...
2
votes
0
answers
59
views
BUGS with very large sample size
I posted this question on the JAGS help discussion, I was seeing if I could get any help here:
I wish to fit a survival model using the data below (first two columns are time points, NA represents ...
2
votes
0
answers
244
views
Is this JAGS model ok, and can it be made faster?
I'm very new to Bayesian analysis, and I've come up with the following model. My goal is to get for each individual "test unit" a distribution that describes the lift in success rate under one of ...
2
votes
0
answers
426
views
How to define a BUGS/JAGS or WinBUGS model with a likelihood node that includes two integrals?
I would like to implement a BUGS/WINBUGS or JAGS model that specifies the likelihood node by marginalizing over two parameters.
Is this feasible in BUGS/WINBUGS or JAGS?
This is the posterior
\begin{...
2
votes
0
answers
2k
views
How to model sum of two values in JAGS?
Imagine, that we measured two values and we know, that in reality one measurement directly corresponds to the latent variable "s1", and the other measurement is in fact sum of two values: "s1" and ...
2
votes
0
answers
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 - ...
1
vote
0
answers
16
views
How do I incorporate sample size as a random variable in a latent interval censored model
I've got a dataset wherein only every third success in a series of n trials is observed. I had originally used the following Bayesian model:
$$
y_i \sim \mathtt{floor}(z_i / 3) \\
z_i \sim B(n_i, p_z) ...
1
vote
0
answers
95
views
Predicting from a Gamma Hurdle Model in JAGS
I fit a gamma hurdle model to invertebrate biomass data and am having trouble predicting from the model. I've been using these posts extensively to try to set it up:
Gamma hurdle model for continuous ...
1
vote
0
answers
172
views
Why am I getting very different results from jags and stan
Why am I getting different results from jags and stan in a simple linear regression model?
Using Sepal.Length ~ Petal.Length in the ...
1
vote
0
answers
117
views
extracting subset of iteration in jags.samples() in r
Using rjags and jags.samples (), I have multiple parameters that are monitored and some parameters are in matrices. This means for example, with 2 chains and 5000 iterations, jags.samples() may return ...
1
vote
0
answers
95
views
Hiearchical Beta-Binomial model via rjags: How to draw posterior sample/do inference on posterior exactly?
I have the following code for bugs model which I want to use with rjags:
...
1
vote
0
answers
57
views
Why is my 95% CI from a simulation being either 100% or 0%?
So what I intended doing with the code is to simulate dataset with the outcome being number of parasites that died (yi) out of every n=50 parasites on the host. There are 2 treatment groups (control ...
1
vote
0
answers
267
views
How to fit a scalable Bayesian VAR model in Stan/JAGS
I am trying to fit a Bayesian vector auto regressive model but I am struggling with the computation. I tried both JAGS and Stan to fit the model but I have never been able to fit it successfully. It ...
1
vote
1
answer
112
views
JAGS: Different results when assigning priors to regression coefficients with a for loop than one by one directly
I want to loop through my coefficients to assign them priors, as demonstrated below:
...
1
vote
0
answers
243
views
How to fit a mixture of 2D Gaussian in BUGS/JAGS?
I am trying to estimate the parameters of a mixture of 2D Gaussian distribution using JAGS. I first created two components from a multivariate normal distribution and then combined them to get a ...
1
vote
1
answer
473
views
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, ...
1
vote
0
answers
669
views
How to do the sensitive analysis for the prior?
I understand bayesian people always do the sensitive analysis for the study.
However, I am confused how we set the sensitive analysis.
My question is how we set the parameter's for the sensitive ...
1
vote
0
answers
126
views
Find DIC values for another sample
I trained a model using JAGS and I obtained parameter values. Can I calculate the DIC values for a subset of these data points. The code is
...
1
vote
0
answers
163
views
Precision prior on Bayesian Linear Regression
I'm currently using Jags to fit a Bayesian linear regression to the Swiss dataset in R.
The model is that $\text{Fertility}_i \sim \text{N}(\mu_i,\tau)$ with precision $\tau$ and mean:
$$\mu_i = \...
1
vote
0
answers
133
views
How to interpret expectation of one specific observation of $u_i$, eg. $E[u_1|X]$?
I'm a bit hung up on how to interpret the expectation of a single observation of the error term... especially in the context of the zero-conditional mean assumption.
If the true population model is ...
1
vote
0
answers
1k
views
Calculate a Bayesian 'posterior predictive p-value' for a multinomial logistic regression
For assessing the fit of a model in a Bayesian framework, 'posterior predictive p-values' (PPPs) are often used. Here, a value close to 0.5 indicates a good fit; a value close to 0 or 1 indicates a ...
1
vote
0
answers
980
views
How to implement Exponential Power distribution in JAGS
I would like to fit a simulated data to Exponential Power likelihood using uniform mixture with gamma mixing presented in "Scale Mixtures Distributions In Statistical Modelling" by Choy and Chan: $EP(...