emcee

Multivariate linear regression in pymc3

自古美人都是妖i 提交于 2020-02-01 09:03:12
问题 I've recently started learning pymc3 after exclusively using emcee for ages and I'm running into some conceptual problems. I'm practising with Chapter 7 of Hogg's Fitting a model to data. This involves a mcmc fit to a straight line with arbitrary 2d uncertainties. I've accomplished this quite easily in emcee , but pymc is giving me some problems. It essentially boils down to using a multivariate gaussian likelihood. Here is what I have so far. from pymc3 import * import numpy as np import

MCMC Sampling a Maxwellian Curve Using Python's emcee

扶醉桌前 提交于 2020-01-05 04:59:17
问题 I am trying to introduce myself to MCMC sampling with emcee. I want to simply take a sample from a Maxwell Boltzmann distribution using a set of example code on github, https://github.com/dfm/emcee/blob/master/examples/quickstart.py. The example code is really excellent, but when I change the distribution from a Gaussian to a Maxwellian, I receive the error, TypeError: lnprob() takes exactly 2 arguments (3 given) However it is not called anywhere where it is not given the appropriate

Using emcee with Gaussian Priors

大憨熊 提交于 2019-12-11 03:35:52
问题 I'm trying to use a gaussian prior using emcee and can't seem to fully figure it out. Basically I want to replace def lnprior(theta): a, b, c = theta if 1.0 < a < 2.0 and 1.0 < b < 2.0 and 1.0 < c < 2.0: return 0.0 return -np.inf with something that would sample 'a' from a gaussian distribution with a mu and sigma. How would I do that? Like this? def lnprior(theta): a, b, c = theta if 1.0 < b < 2.0 and 1.0 < c < 2.0: return 0.0 if 0<a<20: mu=10 sigma=1 s=np.random.normal(mu, sigma) return s

Multivariate linear regression in pymc3

元气小坏坏 提交于 2019-12-04 19:12:16
I've recently started learning pymc3 after exclusively using emcee for ages and I'm running into some conceptual problems. I'm practising with Chapter 7 of Hogg's Fitting a model to data . This involves a mcmc fit to a straight line with arbitrary 2d uncertainties. I've accomplished this quite easily in emcee , but pymc is giving me some problems. It essentially boils down to using a multivariate gaussian likelihood. Here is what I have so far. from pymc3 import * import numpy as np import matplotlib.pyplot as plt size = 200 true_intercept = 1 true_slope = 2 true_x = np.linspace(0, 1, size) #