当我使用plot_ACF和plot_PACF进行时间序列分析时,遇到了一个大问题。
当我运行代码时,它总是向我发出如下警告:
linear_model.py:1283:RuntimeWarning:遇到无效值 sqrt
返回rho,np.sqrt(sigmasq)
,我试图在Google上找到解决方案,但没有发现任何帮助。 如果有人可以帮助我解决此警告,请多加赞赏。 很多很多!
我的编码环境:python 3.6.6 win64
我的笔记本电脑中使用的statsmodels lib: statsmodels-0.9.0-cp36-cp36m-win_amd64
我的源代码在下面列出:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from statsmodels.graphics.tsaplots import plot_acf,plot_pacf
dta=[10930,10318,10595,10972,7706,6756,9092,10551,9722,10913,11151,8186,6422,
6337,11649,11652,10310,12043,7937,6476,9662,9570,9981,9331,9449,6773,6304,9355,
10477,10148,10395,11261,8713,7299,10424,10795,11069,11602,11427,9095,7707,10767,
12136,12812,12006,12528,10329,7818,11719,11683,12603,11495,13670,11337,10232,
13261,13230,15535,16837,19598,14823,11622,19391,18177,19994,14723,15694,13248,
9543,12872,13101,15053,12619,13749,10228,9725,14729,12518,14564,15085,14722,
11999,9390,13481,14795,15845,15271,14686,11054,10395]
dta_list = np.arange(2001,2091)
data=pd.DataFrame(dta,index=dta_list)
data.plot()
plt.show()
D_data=data.diff(1).dropna()
D_data.plot()
plt.show()
plot_acf(D_data).show()
plot_pacf(D_data).show()