matlab aic怎么用,AIC信息准则的编程

1.AIC只需两个inputs ( LLF , numParams)

2.BIC需要三个inputs (LLF , numParams , numObs)

3.aicbic.m在garch toolbox工具箱,AIC,BIC都容易计算,重点是求LLF.

*******************

function [AIC , BIC] = aicbic(LLF , numParams , numObs)

%AICBIC Akaike and Bayesian information criteria for model order selection.

% Given optimized log-likelihood function (LLF) values obtained by fitting

% models of the conditional mean and variance to a univariate return series,

% compute the Akaike (AIC) and Bayesian (BIC) information criteria. Since

% information criteria penalize models with additional parameters, AIC and

% BIC are model order selection criteria based on parsimony. When using

% either AIC or BIC, models that minimize the criteria are preferred.

%

% [AIC , BIC] = aicbic(LLF , NumParams , NumObs)

%

% Optional Inputs: NumObs

%

% Inputs:

% LLF - Vector of optimized log-likelihood objective function (LLF)

% values associated with parameter estimates of various models. The LLF

% values are assumed to be obtained from the estimation function GARCHFIT,

% or the inference function GARCHINFER. Type "help garchfit" or "help

% garchinfer" for details.

%

% NumParams - Number of estimated parameters associated with each value

% in LLF. NumParams may be a scalar applied to all values in LLF, or a

% vector the same length as LLF. All elements of NumParams must be

% positive integers. NumParams may be obtained from the function

% GARCHCOUNT. Type "help garchcount" for details.

%

% Optional Input:

% NumObs - Sample sizes of the observed return series associated with each

% value of LLF. NumObs is required for computing BIC, but is not needed

% for AIC. NumObs may be a scalar applied to all values in LLF, or a

% vector the same length as LLF. All elements NumObs must be positive

% integers.

%

% Outputs:

% AIC - Vector of AIC statistics associated with each LLF objective

% function value. The AIC statistic is defined as:

%

% AIC = -2*LLF + 2*NumParams

%

% BIC - Vector of BIC statistics associated with each LLF objective

% function value. The BIC statistic is defined as:

%

% BIC = -2*LLF + NumParams*Log(NumObs)

%

%example

%garch.pdf page 8-2.

load garchdata

dem2gbp = price2ret(DEM2GBP);

[m,n]=size(dem2gbp); %[1974,1]

NumObs=m; %NumObs=1974

spec11 = garchset('P',1,'Q',1,'Display','off');

[coeff11,errors11,LLF11] = garchfit(spec11,dem2gbp);

garchdisp(coeff11,errors11)

NumParams = garchcount(coeff11); %NumParams=4

format long

[AIC,BIC] = aicbic(LLF11,NumParams,NumObs);

[AIC,BIC]

你可能感兴趣的:(matlab,aic怎么用)