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
1 answer

JAGS error for MCMC Bayesian inference

In R, I am running an MCMC Bayesian inference for data from mixture of Gamma distributions. JAGS is used here. The model file gmd.bug is as follows model { for (i in 1:N) { y[i] ~ dsum(p*one, (1-p)*two) } one ~ dgamma(alpha1, beta1) two ~…
lilkaskitc
  • 15
  • 4
0
votes
1 answer

For Loop with MCMCglmm Regression

I've looked at some of the answers for this question already, there were only two I found helpful and I still cannot get my loop to execute. I am struggling to use a fixed formula for the MCMCglmm package. I have a lot of models to test with this…
Kait
  • 1
0
votes
1 answer

SpBayes for an offset model

I am running spBayes to fit an 'offset' model y ~ 1. I have a dataframe like this ID lon lat y 1 A 90.0 5.9 0.957096100 2 A 90.5 6.0 0.991374969 3 A 91.1 6.0 0.991374969 4 A 92.7 6.1 0.913501740 5 A 94.0 6.1 …
user3910073
  • 511
  • 1
  • 6
  • 23
0
votes
0 answers

Negative binomial model cannot find starting position to sample

I am having difficulties running a PYMC3 model when the observed data is discrete. Oddly, if the observed data contains the value zero (0.), the model will run. I've read in other posts that that suggest using start =…
M. Regan
  • 231
  • 1
  • 8
0
votes
1 answer

MATLAB: Is it inefficient to use parfor (parallel for loop) within a while loop.

I'm having a trouble doing MCMC(Monte Carlo Markov Chain). So for MCMC, say I will run 10000 iterations, then within each iteration, I will draw some parameters. But in each iteration, I have some individual data which are independently, so I can do…
Ruby
  • 284
  • 1
  • 5
  • 18
0
votes
1 answer

How to calculate simulated values while plotting discrepancy plot for goodness of fit?

I am trying to make the discrepancy plot for testing goodness-of-fit after obtaining best fit values by MCMC using pymc. My code goes as: import pymc import numpy as np import matplotlib.pyplot as plt, seaborn as sns # Seeding…
Silentrash
  • 45
  • 5
0
votes
0 answers

Updated: Parallel computing using R result in "attempt to replicate an object of type 'closure'"

I have set up a Metropolis-Hastings algorithm, and now I am trying to run the algorithm using parallel computing. I have set up a single-chain function library(parallel) library(foreach) library(mvtnorm) library(doParallel) n<-100 mX <- 1:n vY <-…
Troels
  • 1
  • 1
0
votes
1 answer

How to evaluate acceptance of metropolis-hastings proposal value when using log-likelihood?

I'm currently writing a MCMC procedure in R for estimation of Rasch model parameters. To do this I use a metropolis-hastings algorithm in a Gibbs sampler. In the code below a part of the proposal function for the item parameters is given. y <-…
Joost
  • 86
  • 6
0
votes
1 answer

MPI: How to get one process to terminate all others - python -> fortran

I have some MPI-enabled python MCMC sampling code that fires off parallel likelihood calls to separate cores. Because it's (necessarily - don't ask) rejection sampling, I only need one of the np samples to be successful to begin the next iteration,…
jtlz2
  • 7,700
  • 9
  • 64
  • 114
0
votes
1 answer

Where is state held in PyMC model?

Given the following model, my question is how does S know anything about alpha, beta, and theta? I've seen examples where MCMC is given a model specified in a separate file (i.e. as a Python module), and that makes some sense to me. But here I have…
Evan Zamir
  • 8,059
  • 14
  • 56
  • 83
0
votes
1 answer

using decorators to define models in PyMC

below is one way to define two stochastic Bernoulli random variables, one depending on the other with decorators. the model is meant to be: p(A) = 0.5 p(B=True|A=True) = 0.75 p(B=True|A=False) = 0.05 using decorators in PyMC it is: import pymc from…
lgd
  • 1,472
  • 5
  • 17
  • 35
0
votes
1 answer

How to do panel data analysis in Bayesian model with pymc

everyone. I have a question on how to do panel data analysis in Bayesian model with pymc. The data is like: .......................................................... User Time x1 x2 x3 Y 1 1 1 …
Runner
  • 1
  • 2
0
votes
1 answer

Using pymc3 to fit Student's t distribution

Not sure if I am doing something silly or pymc3 has a bug, but trying to fit T distribution to normal I get number of degrees of freedom (0.18 to 0.25, I'd expect something high, 4-5 at least). Of course I am getting the same error if I try T…
0
votes
1 answer

Compound model in PyMC

I'm trying to use PyMC 2.3 to obtain an estimate of the parameter of a compound model. By "compound" I mean a random variable that follows a distribution whose whose parameter is another random variable. ("nested" or "hierarchical" are somtimes used…
user2304916
  • 7,882
  • 5
  • 39
  • 53
0
votes
0 answers

Controlling the output messages of MCMC function in the adaptMCMC package

Curious to know if there's any way to disable the output messages that are printed during a run of the MCMC() function in the adaptMCMC package. I'm running this function many times and these print statements are filling up my disk. Here's how it…
user1701545
  • 5,706
  • 14
  • 49
  • 80