%% Modify a Regression Model with ARIMA Errors
% Define the regression model with ARIMA errors:
% \begin{array}{*{20}{l}}
% \begin{array}{c}
% {y_t} = 2 + {X_t}\left[ {\begin{array}{*{20}{c}}
% {1.5}\\
% {0.2}
% \end{array}} \right] + {u_t}\\
% (1 - 0.2L - 0.3{L^2}){u_t} = (1 + 0.1L){\varepsilon _t},
% \end{array}
% \end{array}
% where \varepsilon_{t} is Gaussian with variance 0.5.

Mdl = regARIMA('Intercept',2,'AR',{0.2 0.3},'MA',{0.1},...
    'Variance',0.5,'Beta',[1.5 0.2])

% Mdl is fully specified to, for example, simulate a series of responses given the predictor data matrix, X_{t}.
%
% Modify the model to estimate the regression coefficient, the AR terms, and the variance of the innovations.

Mdl.Beta = [NaN NaN];
Mdl.AR   = {NaN NaN};
Mdl.Variance = NaN;

%
% Change the innovations distribution to a t distribution with 15 degrees of freedom.

Mdl.Distribution = struct('Name','t','DoF',15)

% Copyright 2015 The MathWorks, Inc.