Questions tagged [mcmc]

Markov chain Monte Carlo (MCMC) methods are a class of algorithms for sampling from a probability distribution based on constructing a Markov chain that has the desired distribution as its equilibrium distribution. The state of the chain after a number of steps is then used as a sample of the desired distribution

Source Wikipedia

493 questions
0
votes
0 answers

RJAGS output Node inconsistent with parents

Hi everyone I'm new in JAGS and currently doing a bayesian inference using mcmc through RJAGS. I've been trying my best to debug my code until I'm stuck with this error "Error in node e1[3] Node inconsistent with parents".…
0
votes
1 answer

use emcee to sample probability distribution functions?

I have two arrays (pdf_#), each containing the probability for a parameter (val_#). How can I sample from these distributions to create a joint posterior distribution (i.e. like in the corner plot here)? For emcee it looks like I can only pass…
user2520932
  • 83
  • 2
  • 7
0
votes
1 answer

How does STAN computation time scale with number of iterations?

I'm using MCMC to fit a bayesian mixed model. I have not a particular strong background in coding/computer science and I was wondering about something which seems very weird to me. When I set the number of iterations for my MCMC sampling through…
Tommaso Guerrini
  • 1,499
  • 5
  • 17
  • 33
0
votes
1 answer

MCMCglmm binomial model prior

I want to estimate a binomial model with the R package MCMCglmm. The model shall incorporate an intercept and a slope - both as fixed and random parts. How do I have to specify an accepted prior? (Note, here is a similar question, but in a much more…
Qaswed
  • 3,649
  • 7
  • 27
  • 47
0
votes
1 answer

What are `trait:units` and `variance.function(trait):units` in `MCMCglmm`?

I am trying to perform a MCMCglmm of the kind df=data.frame(y=rep(c(0:2),each=12),x=rnorm(3*12)) MCMCglmm(data=df,fixed=y~x, family="categorical") and I get the error message For error structures involving catgeorical data with more than 2…
Remi.b
  • 17,389
  • 28
  • 87
  • 168
0
votes
1 answer

Error in 'ts' function when using 'zoib' R package for beta regression

I am working with the R package 'zoib' for performing beta regression in R. I am trying to replicate the example included on page 41 in the paper the package authors published in The R Journal: Lui F and Kong Y. 2015. zoib: An R Package for Bayesian…
SlowLoris
  • 995
  • 6
  • 28
0
votes
0 answers

Non-convergance of trace using pymc with logarithmic data

Can't get the trace to converge in my simple polynomial fitting program. I will include an example of the 'a' parameter below. They only thing I can think of is that because I'm using logarithmic data, and the log-likelihood is causing a…
Akerfeldt
  • 31
  • 1
  • 7
0
votes
1 answer

How to update posterior distribution in Gibbs Sampling?

All, I'd like to estimate the parameter P ,Q whose prior distribution is P ~ N (A,B) Q ~ N (C,D) Then, I find the full conditional distribution of P,Q are P|Q ~ N (A*,B*) Q|P ~ N (C*,D*) where A* is a function of A , B , Q [A*=f(A,B,Q)] B* is a…
Ying
  • 1,894
  • 1
  • 14
  • 20
0
votes
1 answer

interpreting posterior distribution in JAGS

Summing up the posterior probabilities of a discrete distribution gives a value of more than one. Where am I going wrong? This is the posterior generated by jags
Bongozil
  • 13
  • 6
0
votes
0 answers

R: Alleged "missing values" when no values are actually missing for MCMCglmm

I have a data structured as follows: A is the count of positive cases in a cohort B is the total count of the cohort minus A. C is a binary variable D- F are normally distributed continuous variables G is 6 level factor I am using MCMCglmm package…
JakeCowton
  • 1,374
  • 5
  • 15
  • 35
0
votes
0 answers

Parallel processing in R and memory management

I have implemented the Metropolis-Hasting algorithm for one my projects and I use that along with "snowfall" package to build different chains of MCMC on different cores. But now, what happens is, as soon as I begin to run my code for example for…
Para2x
  • 61
  • 7
0
votes
0 answers

Hierarchical linear regression in PyMC3, converging issues

(This question is probably easier to understand if you have access to Kruschke's Doing Bayesian Data Analysis book, since I'm trying to build the model on p 493) Basically I'm trying to build this model…
Jon Sjöberg
  • 159
  • 1
  • 7
0
votes
1 answer

Getting input dimensions in pymc3 correct

Say I have 10 coins from the same mint, I flip them each 50 times, now I want to estimate bias of the mint as well as the individual bias of all the coins. The way I want to do this is like this: # Generate a list of 10 arrays with 50 flips in…
Jon Sjöberg
  • 159
  • 1
  • 7
0
votes
1 answer

Two problems on writing a script to compute markov joint distribution (in python)

I'm a new-learner of python, recently I'm working on some project to perform computation of Joint distribution of a markov process. An example of a stochastic kernel is the one used in a recent study by Hamilton (2005), who investigates a nonlinear…
zlqs1985
  • 509
  • 2
  • 8
  • 25
0
votes
1 answer

Estimating AR(1) coefficient using metropolis-Hastings algorithm (MCMC) in R

I am trying to write a program to estimate AR(1) coefficients using metropolis-hastings algorithm. My R code is as following, set.seed(101) #loglikelihood logl <- function(b,data) { ly = length(data) …
Rio
  • 21
  • 2