%% Extract Estimation Results from Fitting Composite Conditional Mean and Variance Model
% Load the NASDAQ data included with Econometrics™ toolbox. Convert the daily close composite index series to a return series. For numerical stability, convert the returns to percentage returns. Specify an AR(1) and GARCH(1,1) composite model. This is a model of the form
% {r_t} = c + {\phi _1}{r_{t - 1}} + {\varepsilon _t},
% where {\varepsilon _t} = {\sigma _t}{z_t},
% \sigma _t^2 = \kappa  + {\gamma _1}\sigma _{t - 1}^2 + {\alpha _1}\varepsilon _{t - 1}^2,
% and z_t is an independent and identically distributed standardized Gaussian process.

load Data_EquityIdx
nasdaq = DataTable.NASDAQ;
r = 100*price2ret(nasdaq);
T = length(r);

Mdl = arima('ARLags',1,'Variance',garch(1,1));

%
% Fit the model Mdl to the return series r by using estimate. Use the presample observations that estimate chooses by default.

EstMdl = estimate(Mdl,r,'Display','params'); 

%
% Create a variable named results that contains the estimation results by using summarize.

results = summarize(EstMdl)

% Extract the parameter estimate summary tables from the estimation results structure array by using dot notation.  The Table field contains the conditional mean model parameter estimates and inferences.  The VarianceTable field contains the conditional variance model parameter estimates and inferences.

meanEstTbl = results.Table
varianceEstTbl = results.VarianceTable

% Copyright 2012 The MathWorks, Inc.