%% Estimate ARIMA Model Parameters Using Initial Values
% Fit an integrated ARIMA(1,1,1) model to the daily close of the NASDAQ Composite Index.
% Load the NASDAQ data included with the toolbox. Extract the first 1500 observations of the Composite Index (January 1990 to December 1995).

load Data_EquityIdx
nasdaq = DataTable.NASDAQ(1:1500);

%
% Specify an ARIMA(1,1,1) model for fitting.

Mdl = arima(1,1,1);

% The model is nonseasonal, so you can use shorthand syntax.
%
% Fit the model to the first half of the data.

EstMdl = estimate(Mdl,nasdaq(1:750));

% The result is a new arima model (EstMdl). The estimated parameters, their standard errors, and t statistics display in the Command Window.
%
% Use the estimated parameters as initial values for fitting the second half of the data.

con0 = EstMdl.Constant;
ar0 = EstMdl.AR{1};
ma0 = EstMdl.MA{1};
var0 = EstMdl.Variance;

[EstMdl2,EstParamCov2,logL2,info2] = estimate(Mdl,....
   nasdaq(751:end),'Constant0',con0,'AR0',ar0,...
   'MA0',ma0,'Variance0',var0);

%
% The parameter estimates are stored in the info data structure. Display the final parameter estimates.

info2.X

% Copyright 2015 The MathWorks, Inc.