Compare information criteria statistics for
several model fits.

Specify the model

where *ε*_{t} is
Gaussian with mean 0 and variance 2. Simulate data from this model.

rng(1); % For random data reproducibility
T = 100; % Sample size
DGP = arima('Constant',-4,'AR',[0.2, 0.5], ...
'Variance',2);
y = simulate(DGP,T);

Define three competing models to fit to the data.

EstMdl1 = arima('ARLags',1);
EstMdl2 = arima('ARLags',1:2);
EstMdl3 = arima('ARLags',1:3);

Fit the models to the data.

logL = zeros(3,1); % Preallocate loglikelihood vector
[~,~,logL(1)] = estimate(EstMdl1,y,'print',false);
[~,~,logL(2)] = estimate(EstMdl2,y,'print',false);
[~,~,logL(3)] = estimate(EstMdl3,y,'print',false);

Compute the AIC and BIC for each model.

[aic,bic] = aicbic(logL, [3; 4; 5], T*ones(3,1))

aic =
381.7732
358.2422
358.8479
bic =
389.5887
368.6629
371.8737

The model containing two autoregressive lag parameters fits
best since it yields the lowest information criteria. The structure
of the best fitting model matches the model structure that simulated
the data.