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

    %% Default Regression Model with AR Errors  
% This example shows how to apply the shorthand |regARIMA(p,D,q)| syntax
% to specify a regression model with AR errors.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Specify the default regression model with AR(3) errors:
%
% $$\begin{array}{l} {y_t} = c + {X_t}\beta  + {u_t}\\ {u_t} = {a_1}{u_{t - 1}} + {a_2}{u_{t - 2}} + {a_3}{u_{t - 3}} + {\varepsilon _t}.\end{array}$$
%
Mdl = regARIMA(3,0,0) 

%%
% The software sets the innovation distribution to |Gaussian|, and each
% parameter to |NaN|. The AR coefficients are at lags 1 through 3.  

%% 
% Pass |Mdl| into |estimate| with data to estimate the parameters set to
% |NaN|. Though |Beta| is not in the display, if you pass a matrix of predictors
% ($X_t$) into |estimate|, then |estimate| estimates |Beta|. The |estimate|
% function infers the number of regression coefficients in |Beta| from the
% number of columns in $X_t$. 
%
% Tasks such as simulation and forecasting using |simulate| and |forecast|
% do not accept models with at least one |NaN| for a parameter value. Use
% dot notation to modify parameter values.