Skip to main content

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
1 vote
1 answer
38 views

Why does the Gelman plot of a JAGS model start at 1000?

I am looking at the diagnostics of a Bayesian model using rjags in R. In particular, I am considering its Gelman-Rubin-Brooks plot. Independent of the number of ...
Lukas D. Sauer's user avatar
0 votes
0 answers
6 views

Confirmation that 0-inflated poisson model is specified correctly in jagsUI package

I have data representing counts of roads within a given cell of a raster (value) and I want to examine how it responds to a fixed effect of year (scaled, year_sc) and two random effects of cell ID and ...
madip's user avatar
  • 1
0 votes
0 answers
31 views

Conditional structure with 4 conditionals in JAGS

I'm using JAGS for Bayesian estimation. Ideally, I would like to define 4 different scenarios (x=a, x=b, x=c, x=d). Depending on the scenario, some different actions should be done. My problem is that ...
Experimental Psychologist's user avatar
0 votes
0 answers
53 views

Definition of priors for GLM

I am building a generalized linear model using the logit function in R using JAGS. Whenever I saw code people only define priors for the parameters of the model, but never for parameters of the ...
user avatar
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) ...
Lemonici's user avatar
1 vote
0 answers
91 views

rjags - implementing a weighted multivariate normal distribution [closed]

I am trying to implement a weighted multivariate normal distribution in JAGS 4.3.0 Here is the code I used: ...
blueblue's user avatar
2 votes
1 answer
117 views

Is it correct to use the posterior distribution from a Bayesian model in other analysis?

I have written a Bayesian model in JAGS that I use to calculate the growth rates of several plant populations as well as their variance while taking into account the observation error during the ...
Héctor Miranda's user avatar
0 votes
0 answers
59 views

Bayesian model (Gibbs sampling) with frequency data for non-standard distribution

I have the following model. \begin{align} X &= D\,(F+S\,(1+G)) \\ D &\sim \mathrm{Exp}\,(\lambda) \\ F &\sim \mathrm{Unif}\,(0,1) \\ S &\sim \mathrm{Poi}\,(\sigma) \\ G &\sim \...
jessexknight's user avatar
1 vote
0 answers
48 views

Power of Bernoulli likelihood in Jags (R2jags) [closed]

In a fixed power prior model, the model is set up as: $$ \pi(p_i \mid \alpha,\mathcal{D}_0) \propto L(p_i\mid \mathcal{D}_0)^{w} \pi(p_i) $$ Suppose that the event follows a Bernoulli distribution ...
Schnappiii's user avatar
0 votes
0 answers
70 views

What Bayesian priors are diffuse on the log scale?

I am trying to come up with priors for the intercept and coefficients of a Bayesian regression model on the log scale, but I can't get the resulting distribution of the prior to be diffuse once I log ...
dankdweb's user avatar
1 vote
0 answers
85 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 ...
Casey S.'s user avatar
1 vote
0 answers
168 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 ...
geom_na's user avatar
  • 151
0 votes
0 answers
274 views

Bayesian Multiple Regression with Interaction

I want to perform a Bayesian analysis (multivariate regression with an interaction term) using this model: DEP ~ beta0 + beta1X1 + beta2X2 + beta3(X1X2)** DEP = Dependent variable (continuous) X1 = ...
Paul Bäumer's user avatar
0 votes
0 answers
145 views

Bayesian Inference with a Normal Likelihood and Gamma Prior

I am fairly new to (the eye-opening world of) Bayesian inference and machine learning and I am stuck at a inference problem that is important to my current research, where I want to introduce Bayesian ...
Masel's user avatar
  • 1
1 vote
0 answers
114 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 ...
QmmmmLiu's user avatar
  • 317
1 vote
0 answers
133 views

JAGS model to PyMC [closed]

I'm trying to translate a code that I have written in JAGS to PyMC but I'm getting stuck due to the recursion in the JAGS code that I can't figure out how to pass it to PyMC. The model in JAGS is ...
Alejandro Andrade's user avatar
1 vote
0 answers
90 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: ...
Kana's user avatar
  • 21
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 ...
soothe's user avatar
  • 11
0 votes
1 answer
313 views

How to use the parameters estimated by MCMC?

Considering this example, taken from the coursera course "Bayesian Statistics: Techniques and Models", Dataset: ...
Incömplete's user avatar
2 votes
1 answer
289 views

Updating prior in MCMC with new estimates for parameters

I'm new to doing Bayesian analysis and I wanted to learn by using baseball data. I took a group of players and found their hits and at bats for various years and I want to be able to get estimates for ...
thatoneguy's user avatar
2 votes
1 answer
638 views

influence of bayesian priors: rjags and categorical variables

I am a bad statistician and new using Bayesian tools, and I am learning how to make regressions with rjags. While toying, I came across a situation I do not fully ...
denis's user avatar
  • 201
0 votes
1 answer
453 views

Jags: Attempt to redefine node error, mixed effect regression [closed]

I want to perform a mixed effect regression in rjags, with a random slope and intercept. I define the following toy dataset: ...
denis's user avatar
  • 201
0 votes
0 answers
25 views

Data-informed grouping of covariates in Bayesian Hierarchical Modeling?

Is there a way to place a prior on the first stage's betas that allows the second stage groups to be determined from the data? I am working with co-exposures where I am not super confident in how they ...
pakalla's user avatar
  • 13
1 vote
1 answer
191 views

Change shape parameters in a beta distribution based in each datapoint [closed]

I am new to Bayesian statistics and I have been trying to implement a Beta Binomial model from a PhD thesis in rjags. The thesis describes prior distribution for the variables but I am stuck in how to ...
Pedro Cruz's user avatar
1 vote
2 answers
69 views

Bayesian model predictions

I am using an exponential decay model for the prediction of chemical exposures. y[i] is measured exposure, and y_new[i] is a prediction for x_new. I expect that new predictions will have exponential ...
eod's user avatar
  • 131
0 votes
0 answers
386 views

Does thinning in JAGS/Stan reduce computational time for simulating a chain of a given length?

Question Let's say we have a complicated model whose posterior distribution we want to draw from using MCMC. To do this, we simulate a chain of total length $N=10,000$. For the sake of this question, ...
bschneidr's user avatar
  • 452
1 vote
1 answer
100 views

JAGS error in the estimation of a simple INAR model

I am having a hard time try to figure out how to translate a simple INAR(1) model in JAGS. \begin{equation} Y_t = \alpha \circ Y_{t-1} + e_t \end{equation} where $\circ$ is the binomial thinning ...
pietrosan's user avatar
1 vote
0 answers
740 views

How to model Beta distribution with Uniform prior in RJAGS? [closed]

I'm having trouble modeling a Bayesian problem in RJAGS. I'm analyzing depth damage curves. In 1988, the US Army Corps of Engineers estimated that 1 foot of flooding would result in 32% mean damage ...
Jason Matney's user avatar
1 vote
0 answers
255 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 ...
Amin Shn's user avatar
  • 765
1 vote
1 answer
226 views

In JAGS, how can I fix a parameter to a distribution, as opposed to just a constant?

The first code chunk below (model1) is a JAGS script designed to estimate a two-group Gaussian mixture model with unequal variances. I am looking for a way to fix one of the parameters (say $\mu_2$) ...
Preston Botter's user avatar
0 votes
1 answer
130 views

Distributions with negative support in JAGS

I am creating a Bayesian regression model where I want to include a prior for a variable that can only have a negative coefficient. What distribution can I use that only has a negative support and is ...
zimia's user avatar
  • 101
1 vote
1 answer
110 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: ...
Jacob Helwig's user avatar
0 votes
0 answers
95 views

Bayesian sequential updating with current Bayesian sampling software?

I'm having a hard time implementing sequential updating with current software, I don't even know how to start. Basically, I'm having to refit the whole model by simply appending the new data to the ...
user avatar
1 vote
0 answers
241 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 ...
Shiva Kazempour's user avatar
1 vote
0 answers
247 views

JAGS Cannot insert node into P[1:3,1:100]. Dimension mismatch [closed]

I am new to JAGS and trying to replicate results from a textbook I have been reading. When I run my code I am persistently getting the error Error in jags.model(model.file, data = data, inits = init....
Death Moose's user avatar
7 votes
3 answers
2k views

Example where the posterior from Jags and Stan are really different and have real impacts on decisions using the model

I have seen many people claiming Stan is "much better" than JAGS, meaning roughly this: "although Jags is much faster, the quality of the samples is worse. So it's worth waiting for the ...
user avatar
2 votes
0 answers
113 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 ...
user2879934's user avatar
0 votes
1 answer
462 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, ...
L.Thoma's user avatar
0 votes
0 answers
29 views

Is it meaningful for a Bayesian to look at the point estimation of posterior density?

I understand Bayesian look at the quantile. But is it useful to look at the posterior mean and posterior median? How to explain it in the plain English?
hard worker's user avatar
1 vote
0 answers
655 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 ...
hard worker's user avatar
0 votes
1 answer
87 views

Is it make sense to set the vague prior when your data size is small?

If the data size is small? should we give the noninformative prior(vague prior) to the data set? I think if the data size is small. It is hard for data to tell the whole story.If you do think we can ...
hard worker's user avatar
0 votes
1 answer
279 views

How to set the gamma prior around the MLE estimate?

I have a MLE estimate for the lambda of the possion distribution. However, the size of my data sets is very small. I choose use the gamma prior in jags. I want to set my prior around the MLE estimate. ...
hard worker's user avatar
2 votes
0 answers
145 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, ...
LiKao's user avatar
  • 2,671
1 vote
0 answers
47 views

Bayesian logistic regression analysis [closed]

I am doing bayesian analysis in which my outcome variable is binary (perinatal mortality). I have a couple of explanatory variables such as gender, birth order, maternal education, residence, maternal ...
Mtani Njegere's user avatar
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 ...
william3031's user avatar
0 votes
0 answers
512 views

What value of thinning is acceptable in Bayesian data analysis?

I am running a poisson regression in rjags. I observed that my trace plots do not converge very well when I use a thin=10 but they all do converge pretty well when I use a thin=1. What is the ...
new_student's user avatar
2 votes
1 answer
305 views

Comparing a Bayesian model with a Classical model for linear regression

I have fitted following Bayesian linear regression model using rjags package in R, with the help of cars data set. I used some weakly informative priors for parameters. ...
student_R123's user avatar
4 votes
1 answer
307 views

Estimating positive and negative predictive value without knowing the prevalence

There is a lot of discussion about the positive predictive value of a test currently. I know that if I know specificity, sensitivity of a test and the prevalence $p$ in the sample, then I can easily ...
LiKao's user avatar
  • 2,671
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 ...
maxdevblock's user avatar
1 vote
1 answer
477 views

One-step ahead predicitons in a Bayesian state-space model

How can I make one-step ahead predictions in a Bayesian state-space model? Specifically, for the model \begin{align} y_t \sim& N(x_t, py) \\ x_t \sim& N(rx_{t-1}, px) \end{align} where $y_t$ ...
user2957945's user avatar

1
2 3 4 5 6