Main Content

检查乘法Arima模型的拟合

此示例显示了如何做适合检查的好处。残留的诊断图有助于验证模型假设,并且交叉验证预测检查有助于评估预测性能。时间序列是1949年至1960年的月度国际航空公司客机数量。

加载数据并估算模型。

Load the airline data set.

加载('data_airline.mat')y = log(数据);t =长度(y);mdl = arima('Constant',0,'D',1,“季节性”,12,...“马拉格”,1,'SMALags',,,,12); EstMdl = estimate(Mdl,y);
ARIMA(0,1,1) Model Seasonally Integrated with Seasonal MA(12) (Gaussian Distribution): Value StandardError TStatistic PValue _________ _____________ __________ __________ Constant 0 0 NaN NaN MA{1} -0.37716 0.066794 -5.6466 1.6364e-08 SMA{12} -0.57238 0.085439 -6.6992 2.0952e -111差异0.0012634 0.00012395 10.193 2.1406E -24

检查残差是否正常。

拟合模型的一个假设是创新遵循高斯分布。推断残差,并检查它们是否正常。

res =推断(estmdl,y);stres = res/sqrt(estmdl.variance);图子图(1,2,1)qqplot(stres)x = -4:.05:4;[f,xi] = ksdenty(stres);子图(1,2,2)图(xi,f,'k',,,,'行宽',,,,2); holdonplot(x,normpdf(x),'r-',,,,'行宽',,,,2) legend(“标准残差”,,,,'Standard Normal') hold离开

图包含2个轴对象。Axes object 1 with title QQ Plot of Sample Data versus Standard Normal contains 3 objects of type line. Axes object 2 contains 2 objects of type line. These objects represent Standardized Residuals, Standard Normal.

分位数量式图(QQ-plot)和内核密度估计没有明显违反正态性假设。

检查残差是否有自相关。

确认残差不相关。查看标准化残差的样品自相关函数(ACF)和部分自相关函数(PACF)图。

图子图(2,1,1)Autocorr(Stres)子图(2,1,2)Parcorr(Stres)

图包含2个轴对象。带有标题样品自相关功能的轴对象1包含4个类型的词干,行。轴对象2带有标题示例部分自相关功能包含4个类型的词干,行。

[h,p] = lbqtest(stres,'lags',[5,10,15],,'dof',[3,8,13])
h =1x3 logical array0 0 0
p =1×30.1842 0.3835 0.7321

示例ACF和PACF情节显示无显著Autocorrelation. More formally, conduct a Ljung-Box Q-test at lags 5, 10, and 15, with degrees of freedom 3, 8, and 13, respectively. The degrees of freedom account for the two estimated moving average coefficients.

Ljung-box Q检验确认了样品ACF和PACF结果。未拒绝所有自相关的无效假设,即与测试滞后的零相同等于零(h = 0) for any of the three lags.

检查预测性能。

Use a holdout sample to compute the predictive MSE of the model. Use the first 100 observations to estimate the model, and then forecast the next 44 periods.

y1 = y(1:100); y2 = y(101:end); Mdl1 = estimate(Mdl,y1);
ARIMA(0,1,1) Model Seasonally Integrated with Seasonal MA(12) (Gaussian Distribution): Value StandardError TStatistic PValue _________ _____________ __________ __________ Constant 0 0 NaN NaN MA{1} -0.35674 0.089461 -3.9876 6.6739e-05 SMA{12} -0.63319 0.098744 -6.4124 1.4326E -100方差0.0013285 0.00015882 8.365 6.013E -17
yF1 = forecast(Mdl1,44,'y0',y1);pmse =平均值((y2-yf1)。^2)
PMSE = 0.0069
图图(Y2,'r',,,,'行宽',2)保持on情节(yf1,'K--',,,,'行宽',,,,1.5) xlim([0,44]) title('Prediction Error') 传奇('观测到的',,,,'预报',,,,'Location',,,,'西北') hold离开

图包含一个轴对象。带有标题预测错误的轴对象包含2个类型行的对象。这些对象表示观察到的预测。

The predictive ability of the model is quite good. You can optionally compare the PMSE for this model with the PMSE for a competing model to help with model selection.

也可以看看

对象

职能

Related Topics