Skip to content

"mk" autocorrelation calculation #22

@grahamgower

Description

@grahamgower

Hi @minaskar,

I looked at the autocorrelation stuff you've just added, and it looks really useful. Thanks!

zeus/zeus/autocorr.py

Lines 54 to 65 in 658ad94

if method == 'mk':
# Minas Karamanis method
f = _autocorr_func_1d(y.reshape((-1), order='C'))
elif method == 'dfm':
# Daniel Forman-Mackey method
f = np.zeros(y.shape[1])
for yy in y:
f += _autocorr_func_1d(yy)
f /= len(y)
else:
# Goodman-Weary method
f = _autocorr_func_1d(np.mean(y, axis=0))

I had a question/comment about the "mk" calculation. It looks like you're wanting to calculate the autocorrelation over each of the chains, which makes more sense to me than averaging over the chains (dfm) or averaging before calculating autocorrelation (Goodman-Weare). But with the mk method, by simply reshaping the 2d y array into a 1d array, the autocorrelation will be artificially lower than it should be, on account of also look at the correlation across the boundary points between chains. I.e. if the chains each have length n, then the autocorrelation of y2 = y.reshape((-1)) will be artifically lower at each position in y2 that is an integral multiple of n.

Wouldn't it be more appropriate to instead take ffts of each chain separately and average over the chains in frequency domain?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions