%% Print ARIMAX Estimation Results
% Print the results of estimating an ARIMAX model.
% Load the Credit Defaults data set, assign the response IGD to Y and the predictors AGE, CPF, and SPR to the matrix X, and obtain the sample size T. To avoid distraction from the purpose of this example, assume that all predictor series are stationary.

load Data_CreditDefaults 
X = Data(:,[1 3:4]);
T = size(X,1);
y = Data(:,5);

%
% Separate the initial values from the main response and predictor series.

y0 = y(1);
yEst = y(2:T);
XEst = X(2:end,:);

%
% Set the ARIMAX(1,0,0) model {y_t} = c + {\phi _1}{y_{t - 1}} + {\varepsilon _t} to MdlY to fit to the data.

MdlY = arima(1,0,0);

%
% Fit the model to the data and specify the initial values.

[EstMdl,EstParamCov] = estimate(MdlY,yEst,'X',XEst,...
'Y0',y0,'Display','off');

%
% Print the estimation results.

 print(EstMdl,EstParamCov) 

% Copyright 2017 The MathWorks, Inc.