Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-correlation in Python #11

Open
mobias17 opened this issue May 30, 2020 · 0 comments
Open

Auto-correlation in Python #11

mobias17 opened this issue May 30, 2020 · 0 comments

Comments

@mobias17
Copy link

Hi @taspinar ,

in http://ataspinar.com/2018/04/04/machine-learning-with-signal-processing-techniques/ auto correlation is based on Numpy, what is totally fine. Also searched for ACF and PCF toolkits and I wanted to point you direction statsmodels.

e.g.

from statsmodels.graphics.tsaplots import plot_acf
from statsmodels.tsa.stattools import acf

plt.plot(t_values,acf(composite_y_value, nlags=N,fft=True),linestyle='-', color='blue')
plt.xlabel('time delay [s]')
plt.ylabel('Autocorrelation amplitude')
plt.show()

plot_acf(composite_y_value,zero=True, lags=N-1)

This returns plots with ACF between -1 and 1, what I would rather expect. Not sure why numpy has this scaling, that is weird to me at least in terms of correlation.

Further, statsmodels.tsa.stattools.acf has a fft parameter that you are refering in your fun fact. Very interesting. Maybe you could elaborate on the transformation between FFT, PSD and the auto-correlation if ever you are making adjustments.

Great blog!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant