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

Mdl = regARIMA('ARLags',[1,4,8],'D',1,'MALags',[1,4],...
    'Intercept',0)

% The AR coefficients are at lags 1, 4, and 8, and the MA coefficients are at lags 1 and 4. The software sets the interim lags to 0.
% Pass Mdl and data into estimate. The software estimates all parameters that have the value NaN. Then estimate holds all interim lag coefficients to 0 during estimation.
% Copyright 2015 The MathWorks, Inc.