【发布时间】:2019-01-04 22:02:14
【问题描述】:
我正在使用来自 statsmodels 的ccf 计算互相关函数。它工作正常,除了我看不到如何绘制置信区间。我注意到acf 似乎有更多的功能。这是一个玩具示例,仅供参考:
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.tsa.stattools as stattools
def create(n):
x = np.zeros(n)
for i in range(1, n):
if np.random.rand() < 0.9:
if np.random.rand() < 0.5:
x[i] = x[i-1] + 1
else:
x[i] = np.random.randint(0,100)
return x
x = create(4000)
y = create(4000)
plt.plot(stattools.ccf(x, y)[:100])
这给出了:
【问题讨论】:
标签: python matplotlib statistics statsmodels