Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么statsmodels';s的相关函数和自相关函数在Python中给出不同的结果?_Python_Numpy_Statsmodels - Fatal编程技术网

为什么statsmodels';s的相关函数和自相关函数在Python中给出不同的结果?

为什么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

我需要获得两个不同序列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))


对于布尔
无偏
参数,这两个函数具有不同的默认参数。要获得与
acf(A,fft=True)
相同的结果,请使用
ccf(A,A,unbiased=False)

#This the autocorrelation using statsmodels's correlation function
plt.plot(ccf(A, A))