Added support for emcee in arviz
See original GitHub issueWanted to let you know we have added support for emcee to the arviz library - see https://github.com/arviz-devs/arviz/pull/302 for a description of the change.
Roughly, the plan is for arviz to replace plotting and diagnostics for pymc3 (so we do not have to rewrite it for pymc4), by converting data to a common data format (netCDF/xarray datasets), and then implementing all the plots and diagnostics on that object. emcee is the third library to have support (pymc3 and pystan), after hearing so many astronomers saying nice things about it at a conference.
In addition to the plots you can see in the pull request above, you can also calculate things like the effective sample size and the gelman rubin statistic. The summary function below shows a number of these.
Some questions I had -
- we store
sample_statsfrom pystan and pymc3. Is there a way to access whether a sample was accepted at a per-draw basis inemcee? - Are there particular diagnostics or plots you would like to see?
import arviz as az
from arviz.tests import helpers
sampler = helpers.emcee_linear_model(None, 500, 10) # this is the sampler from http://dfm.io/emcee/current/user/line/
# This converter turns the data into a netCDF object that can be serialized and shared
data = az.from_emcee(sampler, var_names=['ln(f)', 'b', 'm'])
# all arviz functions should work with this object
az.summary(data).to_dataframe()
| ln(f) | b | m | |
|---|---|---|---|
| metric | |||
| mean | -0.901523 | 4.186736 | -0.493168 |
| standard deviation | 0.083640 | 0.387793 | 0.146651 |
| mc error | 0.002052 | 0.008238 | 0.003727 |
| hpd 3.00% | -1.061138 | 3.448212 | -0.759357 |
| hpd 97.00% | -0.742526 | 4.923531 | -0.201992 |
| effective samples | 1429.248983 | 1408.863122 | 1287.373414 |
| gelman-rubin statistic | 1.030000 | 1.030000 | 1.040000 |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:13 (10 by maintainers)

Top Related StackOverflow Question
I haven’t tested it thoroughly, but the assumptions are not satisfied. I’d recommend checking out this blog post for more discussion and recommended methods for ensemble methods: https://dfm.io/posts/autocorr/
Hello, I seriously need help with emcee. I am trying to fit model spectra to observed ones. After working hard on code, the results are very strange. The chain values of parameters are the same for each walker. I mean the initial values do not change over the chain. Do you have any clue? If needed, I can send the code.