Understanding the MCMC chains.
gully
February 2016
In this Notebook we pretty much just look at the Autocorrelation function, and try some experiments, most of which fizzled out.
See the other notebooks for more conclusive work.
In [8]:
import h5py
f = h5py.File('../data/mc.hdf5', mode='r')
list(f.keys())
Out[8]:
In [9]:
d = f['samples']
In [10]:
list(d.attrs)
Out[10]:
In [11]:
d.attrs['acceptance']
Out[11]:
So the acceptance fraction is about 84%, which seems too high. It should be closer to 23%. So we should increase the typical step size.
In [105]:
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
%config InlineBackend.figure_format = 'svg'
In [16]:
import emcee
In [102]:
ac = emcee.autocorr
In [49]:
x = d[:,0]
x.shape
Out[49]:
In [127]:
acf = ac.function(d[:,5])
In [128]:
plt.plot(acf)
Out[128]:
The autocorrelation function for one of the parameters. Neat!