Compare commits
No commits in common. "3ec98be7cce8e19372bc81390afb03b72c0e2490" and "52e8638a1092384172ae20924bd073d6ffb83855" have entirely different histories.
3ec98be7cc
...
52e8638a10
@ -31,11 +31,9 @@ def Model_checking(model) -> None:
|
|||||||
qqplot(model.resid, line="q", fit=True)
|
qqplot(model.resid, line="q", fit=True)
|
||||||
plt.title("Q-Q图")
|
plt.title("Q-Q图")
|
||||||
plt.show()
|
plt.show()
|
||||||
plt.savefig('QQ图.png')
|
|
||||||
# 绘制直方图
|
# 绘制直方图
|
||||||
plt.hist(model.resid, bins=50)
|
plt.hist(model.resid, bins=50)
|
||||||
plt.show()
|
plt.show()
|
||||||
plt.savefig('直方图.png')
|
|
||||||
|
|
||||||
# 进行Jarque-Bera检验:判断数据是否符合总体正态分布
|
# 进行Jarque-Bera检验:判断数据是否符合总体正态分布
|
||||||
jb_test = sm.stats.stattools.jarque_bera(model.resid)
|
jb_test = sm.stats.stattools.jarque_bera(model.resid)
|
||||||
@ -81,8 +79,8 @@ def cal_time_series(data, forecast_num=3) -> None:
|
|||||||
# 绘制时序图
|
# 绘制时序图
|
||||||
data.plot()
|
data.plot()
|
||||||
# 存储图片
|
# 存储图片
|
||||||
|
plt.savefig('1.png')
|
||||||
plt.show()
|
plt.show()
|
||||||
plt.savefig('时序图.png')
|
|
||||||
|
|
||||||
# 绘制自相关图
|
# 绘制自相关图
|
||||||
plot_acf(data).show()
|
plot_acf(data).show()
|
||||||
@ -137,8 +135,8 @@ def cal_time_series(data, forecast_num=3) -> None:
|
|||||||
diff_data.plot(color='orange', title='残差图')
|
diff_data.plot(color='orange', title='残差图')
|
||||||
model.resid.plot(figsize=(10, 3))
|
model.resid.plot(figsize=(10, 3))
|
||||||
plt.title("残差图")
|
plt.title("残差图")
|
||||||
|
plt.savefig('2.png')
|
||||||
plt.show()
|
plt.show()
|
||||||
plt.savefig('残差图.png')
|
|
||||||
|
|
||||||
# 模型检查
|
# 模型检查
|
||||||
Model_checking(model)
|
Model_checking(model)
|
||||||
|
Loading…
Reference in New Issue
Block a user