时间序列--⽤置信区间更好的解释结果
from pandas import Series
from statsmodels.tsa.arima_model import ARIMA
ries = Series.from_csv('daily-total-female-births.csv', header=0)
toner是什么意思
X = ries.values
X = X.astype('float32')
size = len(X) - 1
train, test = X[0:size], X[size:]
model = ARIMA(train, order=(5,1,1))
model_fit = model.fit(disp=Fal)学位英语考试真题
forecast, stderr, conf = model_fit.forecast()
print('Expected: %.3f' % test[0])a one
print('Forecast: %.3f' % forecast)
print('Standard Error: %.3f' % stderr)
phone什么意思>倒装句讲解
print('95%% Confidence Interval: %.3f to %.3f' % (conf[0][0], conf[0][1]))
结果如下:
Expected: 50.000
Forecast: 45.878
Standard Error: 6.996
peachy95% Confidence Interval: 32.167 to 59.590---------我们有95%的概率落在这个区间
relexfrom pandas import Series
from statsmodels.tsa.arima_model import ARIMA
ries = Series.from_csv('daily-total-female-births.csv', header=0)
X = ries.values
12月四六级成绩查询时间
X = X.astype('float32')
心理学考研科目size = len(X) - 1
train, test = X[0:size], X[size:]
model = ARIMA(train, order=(5,1,1))
model_fit = model.fit(disp=Fal)buzzcocks
intervals = [0.2, 0.1, 0.05, 0.01]
for a in intervals:
forecast, stderr, conf = model_fit.forecast(alpha=a)
print('%.1f%% Confidence Interval: %.3f between %.3f and %.3f' % ((1-a)*100, forecast, conf[0][0], conf[0][1]))
当然可以把区间设置⼤或⼩
80.0% Confidence Interval: 45.878 between 36.913 and 54.844
90.0% Confidence Interval: 45.878 between 34.371 and 57.386
95.0% Confidence Interval: 45.878 between 32.167 and 59.590
99.0% Confidence Interval: 45.878 between 27.858 and 63.898
plot_predict() 可以画出来置信区间
emmm最后⼀点看的有点晕,等⽤到的时候查查这些函数的API把,这⾥现有⼀个⼤致的思想