我需要得到两个不同序列A和B之间的相关性以及A和B的自相关关系。利用statsmodels提供的相关函数,我得到了不同的结果,计算A的自相关和计算A和A之间的相关性是不一样的,为什么结果不同?。在
下面是我所说行为的一个例子:
import numpy as np
from matplotlib import pyplot as plt
from statsmodels.tsa.stattools import ccf
from statsmodels.tsa.stattools import acf
#this is the data series that I want to analyze
A = np.array([np.absolute(x) for x in np.arange(-1,1.1,0.1)])
#This is the autocorrelation using statsmodels's autocorrelation function
plt.plot(acf(A, fft=True))
这两个函数对于boolean
unbiased
参数有不同的默认参数。要获得与acf(A, fft=True)
相同的结果,请使用ccf(A, A, unbiased=False)
。在相关问题 更多 >
编程相关推荐