%% AR Error Model with Nonconsecutive Lags
% This example shows how to specify a regression model with AR errors, where the nonzero AR terms are at nonconsecutive lags.
% Specify the regression model with AR(4) errors:
% \begin{array}{l}{y_t} = c + {X_t}\beta  + {u_t}\\{u_t} = {a_1}{u_{t - 1}} + {a_4}{u_{t - 4}} + {\varepsilon _t}.\end{array}

Mdl = regARIMA('ARLags',[1,4])

% The AR coefficients are at lags 1 and 4.
%
% Verify that the AR coefficients at lags 2 and 3 are 0.

Mdl.AR

% The software displays a 1-by-4 cell array. Each consecutive cell contains the corresponding AR coefficient value.
% Pass Mdl and data into estimate. The software estimates all parameters that have the value NaN. Then, estimate holds a_2 = 0 and a_3 = 0 during estimation.
% Copyright 2015 The MathWorks, Inc.