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

Can't replicate RStan ESS code from Vehtari paper

I am trying to replicate an ESS (effective sample size) calculation using the method of Vehtari et al. in: Rank-normalization, folding, and localization: An improved Rhat for assessing convergence of MCMC I am working from the code…
D_Taylor
  • 3
  • 2
0
votes
2 answers

Receiving error in validObject(.Object), issue with numeric class when running MCMC model using ulam in rstan

I'm writing a model using the ulam function in the rethinking package in rstan. The data list I'm providing it is all numeric (is.numeric returns true for each variable) on its own, but is not as a whole. How can I make it numeric so the model can…
0
votes
1 answer

Guided-LDA without collapsed gibbs sampling

I'm using the python package Guided-LDA with collapsed gibbs sampling [more details]. But I want guided-LDA without collapsed gibbs sampling. How can I separate guided-LDA and collapsed gibbs sampling or how can I get results without collapsed gibbs…
0
votes
0 answers

Fitting multivariate mixed models with continuous and ordinal dependent variables

I would like to run a multivariate mixed regression MCMC model with two response (independent) variables, namely Boldness scores (continuous variable) and Aggression ranks (ordinal ranks). Trial numbers (integers) are the fixed effect while…
0
votes
1 answer

Corner plot add another point

I am using the following MWE: def contour(fit, mu_des,dt_des): la = fit.extract(permuted=True) mu_pos = np.vstack((la['mu'])).T dt_pos = np.vstack((la['dt'])).T postsamples = np.vstack((mu_pos, dt_pos)).T fig =…
deltasata
  • 377
  • 1
  • 4
  • 21
0
votes
0 answers

sourcing files to R script for MCMC (Bayesian Statistics) Analysis in R

I'm trying to run a Linear Regression Bayesian Anaylysis. I'm trying to source a file Jags.R but I keep encountering errors that I'm unable to solve. Here is the main code myData = read.csv(file="HeightWeightData.csv" ) xName = "height" ; yName =…
Rspacer
  • 2,369
  • 1
  • 14
  • 40
0
votes
0 answers

Fit 3d ellipsoid to a distribution of 3d points?

I have a number of points in 3d space (cartesian x,y,z) and would like to fit a ellipsoid to that in order to determine the axis ratios. The issue here is that I have a distribution of points (not points on a surface), and the solutions to this…
0
votes
1 answer

Error messgae in JAGS when defining constraints for priors Attempt to redefine node

I am trying to sample from prior distributions and constrain some of the sums and differences to be greater than 0, however, when I run this code that usually works in OpenBugs/WinBugs, I get the following error 'Attempt to redefine node '. I was…
Martin
  • 171
  • 1
  • 7
0
votes
0 answers

How to provide custom gradients to HMC sampler in tensorflow-probability?

I am trying to use the in-built HMC sampler of tensorflow-probability to generate samples from the posterior. According to documentation, it seems like one has to provide (possibly unnormalized) log density of posterior to target_log_prob_fn…
0
votes
0 answers

R: burnin.phybreak - Error in if (runif(1) < exp(logaccprob))

I'm trying to use the burnin.phybreak function to run an MCMC-chain however, I keep getting the following error message and have no idea how to proceed; Error in if (runif(1) < exp(logaccprob)) { : missing value where TRUE/FALSE needed I have…
sruby52
  • 83
  • 1
  • 6
0
votes
1 answer

Why does pymc3 run even when I don't include any observations?

Even when I don't include any observed values, pymc3 will still run and give me results. Is this just sampling from the prior without the likelihood? ''' import pymc3 as pm model = pm.Model() with model: # Define the prior of the parameter…
ramen_noodles
  • 53
  • 1
  • 8
0
votes
2 answers

Metropolis-Hastings in matlab

I am trying to use the Metropolis Hastings algorithm with a random walk sampler to simulate samples from a function $$ in matlab, but something is wrong with my code. The proposal density is the uniform PDF on the ellipse 2s^2 + 3t^2 ≤ 1/4. Can I…
Natalie_94
  • 79
  • 3
  • 12
0
votes
1 answer

PyMC3: Giving a Different Result Every time

I have defined a log-likelihood function and I have one variable being sampled over a uniform distribution. I made sure the log-likelihood function returns the same result for same input. But when I sample, every time the distribution is somewhat…
user1581390
  • 1,900
  • 5
  • 25
  • 38
0
votes
1 answer

How to batch a transformed (scaled and quantized) Beta distribution in tensorflow probability

I'm trying to fit a beta distribution to the results of a survey with discrete scores (1, 2, 3, 4, 5). For that to work I need a working log_prob of a Beta in TensorFlow probability. However, there is a problem with how batching is handled in…
rv_normal
  • 80
  • 9
0
votes
1 answer

How to include data measurement uncertainty in stan/pystan

I am completely new to stan. I simply wanted to fit a data which has uncertainty in measurements, but I could not include the uncertainty in the fitting. For example, I have x[N], y[N] and yerror[N] arrays with dimension N. Suppose the data is 2nd…
deltasata
  • 377
  • 1
  • 4
  • 21