📄 garchcount.m
字号:
function nParameters = garchcount(Coefficients)
%GARCHCOUNT Count GARCH estimation coefficients.
% Given a GARCH Toolbox specification structure containing coefficient
% estimates and equality constraint information, count and return the
% number of estimated coefficients. This function is a helper utility
% designed to support the GARCH Toolbox model selection function AICBIC.
%
% NumParams = garchcount(Coeff)
%
% Input:
% Coeff - GARCH Toolbox specification structure containing the estimated
% coefficients and equality constraints. Coeff is an output of the
% estimation function GARCHFIT. Type "help garchfit" for details.
%
% Output:
% NumParams - Number of estimated parameters. NumParams is defined as the
% number of parameters (i.e., coefficients) included in the conditional
% mean and variance specifications, less any parameters held constant,
% as equality constraints, during the estimation. NumParams is needed
% for calculating the AIC/BIC statistics. Type "help aicbic" for details.
%
% See also GARCHFIT, AICBIC, GARCHDISP.
% Copyright 1999-2002 The MathWorks, Inc.
% $Revision: 1.5 $ $ Date: 1998/01/30 13:45:34 $
if ~isstruct(Coefficients)
error(' ''Coeff'' must be a structure.')
end
%
% Extract model orders.
%
R = garchget(Coefficients , 'R'); % Conditional mean AR order.
M = garchget(Coefficients , 'M'); % Conditional mean MA order.
P = garchget(Coefficients , 'P'); % Conditional variance order for lagged variances.
Q = garchget(Coefficients , 'Q'); % Conditional variance order for lagged squared residuals.
nX = length(garchget(Coefficients , 'Regress')); % Number of regressors.
%
% Extract equality constraint information for coefficients.
%
FixC = garchget(Coefficients , 'FixC');
FixAR = garchget(Coefficients , 'FixAR');
FixMA = garchget(Coefficients , 'FixMA');
FixRegress = garchget(Coefficients , 'FixRegress');
FixK = garchget(Coefficients , 'FixK');
FixGARCH = garchget(Coefficients , 'FixGARCH');
FixARCH = garchget(Coefficients , 'FixARCH');
if isempty(FixC) , FixC = 0; end
if isempty(FixAR) , FixAR = zeros(R,1); end
if isempty(FixMA) , FixMA = zeros(M,1); end
if isempty(FixRegress) , FixRegress = zeros(nX,1); end
if isempty(FixK) , FixK = 0; end
if isempty(FixGARCH) , FixGARCH = zeros(P,1); end
if isempty(FixARCH) , FixARCH = zeros(Q,1); end
Fix = [FixC ; FixAR(:) ; FixMA(:) ; FixRegress(:) ; FixK ; FixGARCH(:) ; FixARCH(:)];
nParameters = (1 + R + M + nX + 1 + P + Q) - sum(Fix);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -