%% Default Regression Model with ARIMA Errors
% This example shows how to apply the shorthand regARIMA(p,D,q) syntax to specify the regression model with ARIMA errors.
% Specify the default regression model with ARIMA(3,1,2) errors:
% \begin{array}{c}{y_t} = c + {X_t}\beta  + {u_t}\\\left( {1 - {a_1}L - {a_2}{L^2} - {a_3}{L^3}} \right)\left( {1 - L} \right){u_t} = \left( {1 + {b_1}L + {b_2}{L^2}} \right){\varepsilon _t}.\end{array}

Mdl = regARIMA(3,1,2)

% The software sets each parameter to NaN, and the innovation distribution to Gaussian. The AR coefficients are at lags 1 through 3, and the MA coefficients are at lags 1 and 2. The property P = p + D = 3 + 1 = 4. Therefore, the software requires at least four presample values to initialize the time series.
% Pass Mdl into estimate with data to estimate the parameters set to NaN. The regARIMA model sets Beta to [] and does not display it. 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.
% Be aware that the regression model intercept (Intercept) is not identifiable in regression models with ARIMA errors. If you want to estimate Mdl, then you must set Intercept to a value using, for example, dot notation. Otherwise, estimate might return a spurious estimate of Intercept.
% Copyright 2015 The MathWorks, Inc.