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
0 votes
0 answers
22 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
32 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
13 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
41 views

rjags - implementing a weighted multivariate normal distribution

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
72 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
56 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
0 votes
0 answers
12 views

How to make predictions with parameters obtained from a zero-inflated Poisson model with Bayesian approach?

I have a dataset with one response variable and one explanatory variable. Here is my zero-inflated Poisson model with a Bayesian approach. ...
Juan's user avatar
  • 85
0 votes
0 answers
9 views

Arithmetic using summary means of the MCMC chains, differ from when I do the arithmetic directly using each row of the MCMC chains

I am trying to calculate the 'absolute risk difference' and 'needed to treat' (NNT). NNT is 1/(absolute risk difference) where the absolute risk difference is just the rate of an event in one ...
sol libes's user avatar
0 votes
0 answers
15 views

Bayesian modeling of data at different cluster level

I have the following data: The response variable Y and the independent variable X2 were collected at state level (lowest level), while X1 are only available at country level. The general form of my ...
new_student's user avatar
0 votes
0 answers
27 views

RJAGS - Zero Inflated Negative Binomial RJAGS

I am trying to fit a RJAGS zero-inflated negative binomial model. The data I am using has 451 observation and only 12 of them have values different to 0, which means that 97% of my observations are 0. ...
juands's user avatar
  • 11
1 vote
0 answers
44 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
61 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
61 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
123 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
148 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
80 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
0 votes
0 answers
68 views

JAGS: predicting missing values in a **discrete** covariate

I am fitting a hierarchical model with NAs in my predictors. What I understand from Kéry & Royle Vol. 1, p. 175 is that, for a continuous predictor, you can model the NAs by fitting a normal ...
FrsLry's user avatar
  • 145
0 votes
0 answers
79 views

How to correctly include an offset in a bernouli model in JAGS/WINBUGS (Only one success, but number of choices can change)

I am trying to fit a Bernoulli model in Jags. This is for mate choice - whether a male interacts with a given female out of a selection of females. For the purpose of the model they only get one ...
Graham Birch's user avatar
1 vote
0 answers
85 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
  • 327
1 vote
0 answers
111 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
76 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
55 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
267 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
187 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
0 votes
1 answer
504 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
  • 211
0 votes
1 answer
393 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
  • 211
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
160 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
67 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
341 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
  • 347
0 votes
1 answer
83 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
574 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
207 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
  • 745
1 vote
1 answer
191 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
116 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
97 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
84 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
220 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
218 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
6 votes
2 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
1 vote
0 answers
92 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
396 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
562 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
77 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
254 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
132 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,641
1 vote
0 answers
43 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
85 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
414 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

1
2 3 4 5
7