【发布时间】:2021-06-12 06:25:01
【问题描述】:
我有一个从 1990 年到 2017 年的年度碳排放数据(28 个数据点),我想对其进行时间序列预测。窗口为 2 的数据的滚动平均值随着时间的推移不断增加,这表明我的数据不是静止的,但 dicky-fuller 检验给出的 p 值为 0.04,小于 0.05,因此这表明数据是静止的。 在这种情况下可以做什么?
def rolling_stats(time_data):
rolling_mean=time_data.rolling(2).mean()
rolling_std=time_data.rolling(2).std()
raw_data=plt.plot(time_data,color="blue",label="Original Data")
mean=plt.plot(rolling_mean,color="green",label="mean")
std=plt.plot(rolling_std,color="red",label="std")
plt.legend(loc="best")
plt.title("Mean and standard deviation")
plt.xlabel("Years")
plt.ylabel("Carbon emitted in megatonnes")
rolling_stats(CarbonEmitted)
【问题讨论】:
-
看来您的问题不是关于编程,而是关于统计?如果您有需要解决问题的代码,请包含它,并且您可能还希望包含数据和代码以显示绘图,而不是图像,因为图像看起来不是您的样子有问题。
-
我使用 adfuller 进行 dicky-fuller 测试并使用 pd.rolling().mean() 来找到滚动平均值
标签: python time-series arima