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

    %% Convert a VARMA Model to a VAR Model
% This example creates a VARMA model, then converts it to a pure VAR model.
%% 
% Create a VARMA model specification structure.

% Copyright 2015 The MathWorks, Inc.

A1 = [.2 -.1 0;.1 .2 .05;0 .1 .3];
A2 = [.3 0 0;.1 .4 .1;0 0 .2];
A3 = [.4 .1 -.1;.2 -.5 0;.05 .05 .2];
MA1 = .2*eye(3);
MA2 = [.3 .2 .1;.2 .4 0;.1 0 .5];
Spec = vgxset('AR',{A1,A2,A3},'MA',{MA1,MA2})
%%
% Convert the structure to a pure VAR structure:
SpecAR = vgxar(Spec)
%%
% The converted process is unstable; see the AR row. An unstable model
% could yield inaccurate predictions. Taking more terms in the series gives
% a stable model:
specAR4 = vgxar(Spec,4)