与Multiplicativ估计回归模型e ARIMA Errors
This example shows how to fit a regression model with multiplicative ARIMA errors to data usingestimate
.
加载航空公司和经济衰退数据集。绘制每月乘客的总计和总数日志。
load('Data_Airline.mat') 加载data_r ensuctsy =数据;logy = log(y);图子图(2,1,1)图(y)标题(y)标题('{\bf Monthly Passenger Totals (Jan1949 - Dec1960)}')DateTick子图(2,1,2)图(log(y))标题('{\ bf每月乘客日志 - 1949年1月-DEC1960)}')DateTick
The log transformation seems to linearize the time series.
Construct the predictor (X
),这是该国在采样期间是否处于衰退状态。A行排成0t意味着该国没有在一个月内衰退t, and a 1 in rowt意味着它是一个月的经济衰退t.
x = zeros(numel(date),1);% Preallocationforj = 1:size(衰退,1)x(日期> =衰减(j,1)&dates <=渗入(j,2))= 1;end
合身the simple linear regression model
到数据。
合身= fitlm(X,logY);
合身
is a线性模型
that contains the least squares estimates.
Check for standard linear model assumption departures by plotting the residuals several ways.
图子图(2,2,1)绘图(拟合,'caseorder','ResidualType','Standardized',...'linestyle',“- - -”,“标记”,0.5)H = GCA;h.fontsize = 8;子图(2,2,2)绘图(拟合,“滞后”,'ResidualType','Standardized')h = gca;h.fontsize = 8;subplot(2,2,3) plotResiduals(Fit,'可能性','ResidualType','Standardized')h = gca;h.YTick = h.YTick(1:2:end); h.YTickLabel = h.YTickLabel(1:2:end,:); h.FontSize = 8; subplot(2,2,4) plotResiduals(Fit,'histogram','ResidualType','Standardized')h = gca;h.fontsize = 8;
r = Fit.Residuals.Standardized; figure subplot(2,1,1) autocorr(r) h = gca; h.FontSize = 9; subplot(2,1,2) parcorr(r) h = gca; h.FontSize = 9;
The residual plots indicate that the unconditional disturbances are autocorrelated. The probability plot and histogram seem to indicate that the unconditional disturbances are Gaussian.
The ACF of the residuals confirms that the unconditional disturbances are autocorrelated.
Take the 1st difference of the residuals and plot the ACF and PACF of the differenced residuals.
dr = diff(r);图子图(2,1,1)Autocorr(DR,DR,'NumLags',50) h = gca; h.FontSize = 9; subplot(2,1,2) parcorr(dR,'NumLAgs',50) h = gca; h.FontSize = 9;
The ACF shows that there are significantly large autocorrelations, particularly at every 12th lag. This indicates that the unconditional disturbances have 12th degree seasonal integration.
取决于残留物的第一和第十二差异。绘制差异残差及其ACF和PACF。
diffpoly = lagop([1 -1]);sdiffpoly = lagop([1 -1],,“滞后”,[0, 12]); diffR = filter(DiffPoly*SDiffPoly,r); figure subplot(2,1,1) plot(diffR) axis紧的subplot(2,2,3) autocorr(diffR) h = gca; h.FontSize = 7; axis紧的subplot(2,2,4) parcorr(diffR) h = gca; h.FontSize = 7; axis紧的
残留物类似于白噪声(可能具有异方差)。根据Box and Jenkins(1994),第9章,ACF和PACF表明无条件的干扰是 model.
Specify the regression model with 错误:
Mdl = regARIMA('MALags',1,'D',1,'Seasonality',12,'Smalags',12)
mdl =带有属性的雷加里玛:描述:“ Arima(0,1,1)误差模型与季节性MA(12)(高斯分布)(高斯分布)”“分布:name =“ Gaussian”截距:NAN BETA:[1×0] P:13 D:1 Q:13 ar:{} sar:{} ma:{nan}在lag [1] sma:{nan} lag [12]季节性:12方差:NAN
Partition the data set into the presample and estimation sample so that you can initialize the series.P
=Q
= 13, so the presample should be at least 13 periods long.
preLogY = logY(1:13);%预先样本响应estLogY = logY(14:end);%估计样本响应preX = X(1:13);% Presample predictorsestX = X(14:end);%估计样品预测指标
从预先样本数据的线性回归中获取前样品无条件干扰。
PreFit = fitlm(preX,preLogY);...%的预先拟合前样品残留物estfit = fitlm(estx,estlogy);...% Estimation sample fit for the interceptU0 = PreFit.Residuals.Raw;
If the error model is integrated, then the regression model intercept is not identifiable. Set截距
to the estimated intercept from a linear regression of the estimation sample data. Estimate the regression model with IMA errors.
Mdl.Intercept = EstFit.Coefficients{1,1}; EstMdl = estimate(Mdl,estLogY,'X',estX,'u0',U0);
Regression with ARIMA(0,1,1) Error Model Seasonally Integrated with Seasonal MA(12) (Gaussian Distribution): Value StandardError TStatistic PValue _________ _____________ __________ __________ Intercept 5.5722 0 Inf 0 MA{1} -0.025366 0.22197 -0.11427 0.90902 SMA{12} -0.80255 0.052705 -15.227 2.3349e -52 beta(1)0.0027588 0.10139 0.02721 0.97829方差0.00724663 0.00015974 45.365 0 0
MA{1}
和beta1
与0。您可以从模型中删除这些参数,可能会添加其他参数(例如AR参数),并使用多个模型拟合使用aicbic
. Note that the estimation and presample should be the same over competing models.
References:
Box, G. E. P., G. M. Jenkins, and G. C. Reinsel.Time Series Analysis: Forecasting and Control. 3rd ed. Englewood Cliffs, NJ: Prentice Hall, 1994.