%% Regression Model with AR Errors
% This example shows how to plot the impulse response function for a regression model with AR errors.
% Specify the regression model with AR(4) errors:
% \begin{array}{l}{y_t} = 2 + {X_t}\left[ \begin{array}{l}5\\ - 1\end{array} \right] + {u_t}\\{u_t} = 0.9{u_{t - 1}} - 0.8{u_{t - 2}} + 0.75{{\rm{u}}_{t - 3}} - 0.6{{\rm{u}}_{t - 4}} + {\varepsilon _t}.\end{array}

Mdl = regARIMA('Intercept',2,'Beta',[5; -1],'AR',...
    {0.9, -0.8, 0.75, -0.6})

% The dynamic multipliers are absolutely summable because the autoregressive component is stable. Therefore, Mdl is stationary.
% You do not need to specify the innovation variance.
%
% Plot the impulse response function.

impulse(Mdl)

% The impulse response decays to 0 since Mdl defines a stationary error process. The regression component does not impact the impulse responses.
% Copyright 2015 The MathWorks, Inc.