Hot answers tagged

8 votes
Accepted

What is causing autocorrelation in MCMC sampler?

When using Markov chain Monte Carlo (MCMC) algorithms in Bayesian analysis, often the goal is to sample from the posterior distribution. We resort to MCMC when other independent sampling techniques ...
Greenparker's user avatar
  • 15.1k
7 votes

Naive SE vs Time Series SE: which statistics should I report after Bayesian estimation?

These are measures of the computational MCMC error for the estimation of the posterior expected value of a parameter. One way of interpreting them is by comparing this MCMC error with the Standard ...
Rufo's user avatar
  • 553
5 votes
Accepted

Multi-level Bayesian hierarchical regression using rjags

You want a distribution for each quarter (given a state), each state (given a region), and each region. That means you'll need at least some state parameters indexed by s (in your model b0, b1, ...
user98453's user avatar
5 votes

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

The use of vague or informative prior depends on the amount of knowledge that you have for the parameters that you want to assign the prior. I consider the following cases: No experts information and ...
Fiodor1234's user avatar
  • 2,152
4 votes

How to implement credible 95% interval for median odds ratio using JAGS?

I don't know if this is a solution for you, but since the lme4 glmer function can provide random intercept posterior median estimates and their conditional variance - and under the assumption of ...
Milan Seth's user avatar
4 votes
Accepted

My MCMC do not overlap : Mixturemodel with JAGS and R

Imagine you have a mixture of two normal distributions, the one on the left (L) and the one on the right (R) side of the plot presented below. To estimate $\mu_L$ and $\mu_R$ parameters you decide to ...
Tim's user avatar
  • 136k
4 votes

Invalid parent values in JAGS

This is just a guess, but one of the distributions might be receiving invalid values. For example you have the line: ...
Jeromy Anglim's user avatar
4 votes
Accepted

Bayesian errors-in-variables model definition in JAGS and symbolically

JAGS model notation is almost exactly the same as would you describe this model mathematically: $$ \alpha \sim \mathrm{Normal}(0, .001) \\ \beta \sim \mathrm{Normal}(0, .001) \\ \sigma_y \sim \...
Tim's user avatar
  • 136k
4 votes
Accepted

coding a JAGS error model for a dependent variable that has increasing variance as a function of the magnitude of the dependent variable

JAGS does not allow directed cycles (parameters being used to define themselves), so you can't use y to define the parents of y. That means that if y appears on the left hand of a distribution, then ...
Matt Denwood's user avatar
  • 1,026
4 votes

How do I specify a Bayesian Beta binomial model, with predictor variables, for R2jags?

It is not really a "how to code it in JAGS" problem, but it is about defining the appropriate model for your data. If you want to include predictor variables for your data, this means you need a ...
Tim's user avatar
  • 136k
4 votes
Accepted

Mixture of Normal and Exponential distributions with unkown weights and parameters using JAGS

Your posteriors look suspiciously like your priors, which usually indicates that your model is not being fit to data. My best guess is that you have not correctly included the vector "Ones" with your ...
Matt Denwood's user avatar
  • 1,026
4 votes
Accepted

"Mixed effect" ANOVA in R with JAGS/BUGS

In order to include a random effect (and potentially other fixed effects) you need to format your data in long (rather than wide) format, and use nested indexing with separate vectors as indicator ...
Matt Denwood's user avatar
  • 1,026
4 votes

Estimating positive and negative predictive value without knowing the prevalence

I don't use RJags so I can't confirm your code but I would say 'yes' your idea makes sense with three caveats: First, (intuitively) your likelihood contains little-to-no information on the prevalence ...
psboonstra's user avatar
  • 2,015
4 votes

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

Whenever I want to get started with understanding a new statistical topic, I start by reading articles about it. In this case, I'd start with Carpenter et al. "Stan: A Probabilistic Programming ...
Sycorax's user avatar
  • 89.1k
4 votes
Accepted

influence of bayesian priors: rjags and categorical variables

If you set as a prior for the ID coefficients a uniform distribution between -5 and 5, this means that these coefficients are assumed to be in the interval $[-5,5]$, other values are impossible. These ...
Christian Hennig's user avatar
3 votes
Accepted

reduce size of an MCMC/ rjags object

Three thoughts: That many samples until convergence sounds like there are issues with your model/priors. The diagnosis would require seeing the model -- and also more knowledge than I have. Some ...
Wayne's user avatar
  • 20.8k
3 votes
Accepted

error when running JAGS

As your error message says Error in node xtrue[1] Invalid parent values the xtrue variable has invalid parent values, so ...
Tim's user avatar
  • 136k
3 votes

Appropriate GLM when response variable is proportion, but not binomial

Before venturing into the territory of GLMs it might be worth fitting a regression model on an appropriately transformed version of the response variable. If we let $0<Y_i<1$ be the area-...
Ben's user avatar
  • 118k
3 votes

Combining posterior distributions

Unfortunately, you cannot combine posterior chains in that way. From your description, what you have are independent draws from MCMC chains for the following posterior distributions: $$p(\beta|\...
Ben's user avatar
  • 118k
3 votes

What prior distributions could/should be used for the variance in a hierarchical bayesisan model when the mean variance is of interest?

I disagree with the way you interpret Gelman concerning the choice of the Gamma for scale parameter. The basis of hierarchical modeling is to relate individual parameters to a common one through a ...
beuhbbb's user avatar
  • 4,903
3 votes

Bayesian approach systematically overestimates sigma (SD)

I haven't checked everything in your zip file, but the problem seemed to be simple enough based on the JAGS model you have posted. The discrepancy between sd and JAGS output is due to sensitivity to ...
psolymos's user avatar
3 votes
Accepted

rjags mixture model for a combination of normal and gamma distributions

It is relatively easy to implement a mixture model where the different distributions have the same parametric family - the dnormmix distribution in JAGS does this using an inbuilt distribution for a ...
Matt Denwood's user avatar
  • 1,026
3 votes
Accepted

Bayesian autoregressive model with second peak at 1 in posterior distirbution of AR parameter

The peak can be eliminated by using a different prior for $\mu$. The simplest way to implement the new prior is to change the parameterization. Currently, you have \begin{equation} y_{t+1} = (1-\rho)\,...
mef's user avatar
  • 3,226
3 votes
Accepted

Bayesian p-value in wrong direction using step function in JAGS / BUGS

The so-called 'Bayesian p-value' does not have the same interpretation as a true p-value: remember that you do not have a formal hypothesis test so there is no real concept of a 'probability of the ...
Matt Denwood's user avatar
  • 1,026
3 votes

R alternatives to JAGS/BUGS

Probably the most powerful Bayesian package presently available in R is the RStan package (which has a whole website here). ...
Ben's user avatar
  • 118k
3 votes
Accepted

Comparing a Bayesian model with a Classical model for linear regression

Try: ...
Sergio's user avatar
  • 5,921
2 votes

MCMC converging to a single value?

This is more a comment, but as I do not have enough reputation I might as well answer. From my limited experience with MCMC samplers, what I have observed is that the parameters tend to stay fixed ...
Giezi's user avatar
  • 79
2 votes

Bayesian variable selection -- does it really work?

If you used log returns, then you made a slightly biasing error but if you used future value divided by present value then your likelihood is wrong. Actually, your likelihood is wrong in either case. ...
Dave Harris's user avatar
  • 7,492
2 votes

What is the distribution of the ratio of two normals?

What is the distribution of the ratio of two normals? A related question is A/B testing ratio of sums The following is from a part of an answer to that question. (You state that both variables are ...
Sextus Empiricus's user avatar
2 votes
Accepted

What is the distribution of the ratio of two normals?

You do not need to know the distribution of the dependent variable to design a useful regression model. One introduction to the assumptions of linear regression is available here. You need to ...
EdM's user avatar
  • 86.7k

Only top scored, non community-wiki answers of a minimum length are eligible