Closed magland closed 1 year ago
Thanks! That's an easy change, and I'll try to follow up with you so that I can understand what's going on. It looked like this was getting the same autocorrelation estimates as the built-in in Python, but maybe I wasn't testing enough conditions.
And yes, we should probably only keep the first half of the output as each lag is estimated using one fewer data points than the last, and the whole thing's stochastic, so the noise piles up quickly.
Thanks! That's an easy change, and I'll try to follow up with you so that I can understand what's going on. It looked like this was getting the same autocorrelation estimates as the built-in in Python, but maybe I wasn't testing enough conditions.
Strange. Did you try it for only power-of-2 sized examples, perhaps?
I agree now that the fft code is correct. Closing.
https://github.com/flatironinstitute/bayes-kit/blob/8f8c494cf65ce39f0982566b54ed1a9a277f8c82/bayes_kit/ess.py#L8-L26
Seems that you are truncating the Fourier coefficients to force them to be a power of 2. When transforming back the power spectrum, this will have the effect of sampling on a different grid than the original data. This can be solved by omitting the size parameter, and just doing the full fft. You may also consider keeping only the first half of the output array.