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