www.gusucode.com > econ 案例源码程序 matlab代码 > econ/EstimateMultiplicativeARIMAModelExample.m

    %% Estimate Multiplicative ARIMA Model  
% This example shows how to estimate a multiplicative seasonal ARIMA model
% using |estimate|. The time series is monthly international airline passenger
% numbers from 1949 to 1960.   

% Copyright 2015 The MathWorks, Inc.


%% Load the Data and Specify the model. 
% Load the airline data set.
load(fullfile(matlabroot,'examples','econ','Data_Airline.mat'))
y = log(Data);
T = length(y);

Mdl = arima('Constant',0,'D',1,'Seasonality',12,...
    'MALags',1,'SMALags',12);  

%% Estimate the Model Using Presample Data. 
% Use the first 13 observations as presample data, and the remaining 131
% observations for estimation. 
y0 = y(1:13);
[EstMdl,EstParamCov] = estimate(Mdl,y(14:end),'Y0',y0) 

%%
% The fitted model is 
%
% $$\Delta {\Delta _{12}}{y_t} = (1 - 0.38L)(1 - 0.57{L^{12}}){\varepsilon _t},$$
% 
% with innovation variance 0.0014.  

%%
% Notice that the model constant is not estimated, but remains fixed at
% zero. There is no corresponding standard error or t statistic for the
% constant term. The row (and column) in the variance-covariance matrix
% corresponding to the constant term has all zeros.  

%% Infer the Residuals. 
% Infer the residuals from the fitted model. 
res = infer(EstMdl,y(14:end),'Y0',y0);

figure
plot(14:T,res)
xlim([0,T])
title('Residuals')
axis tight

%%
% When you use the first 13 observations as presample data, residuals are
% available from time 14 onward.
%%
% 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.