为什么statsmodels';s的相关函数和自相关函数在Python中给出不同的结果?
我需要获得两个不同序列A和B之间的相关性以及A和B的自相关性。使用statsmodels提供的相关函数,我得到了不同的结果,计算A的自相关性和计算A和A之间的相关性是不一样的,为什么结果不同 下面是我所说的行为的一个例子:为什么statsmodels';s的相关函数和自相关函数在Python中给出不同的结果?,python,numpy,statsmodels,Python,Numpy,Statsmodels,我需要获得两个不同序列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 ac
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))
对于布尔
无偏参数,这两个函数具有不同的默认参数。要获得与acf(A,fft=True)
相同的结果,请使用ccf(A,A,unbiased=False)
#This the autocorrelation using statsmodels's correlation function
plt.plot(ccf(A, A))