⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 garchget.m

📁 灰色控制 灰色控制 matlab
💻 M
字号:
function o = garchget(options,name,default)
%GARCHGET Get GARCH Toolbox specification parameters.
%   GARCHGET provides the main user-interface for accessing GARCH Toolbox
%   structures, and is the preferred method for extracting GARCH model 
%   specification parameters.
%
%   ParameterValue = garchget(Spec , 'ParameterName')
%
% Inputs:
%   Spec - A structure encapsulating the styles, orders, coefficients, 
%     and optimization constraints and parameters of the conditional mean
%     and variance specifications of a GARCH model. Spec should be created 
%     with the companion function GARCHSET. Type "help garchset" for details.
%
%   ParameterName - String indicating the parameter name to be accessed. The 
%     value of the named parameter is extracted from the structure Spec; an
%     empty matrix is returning if the parameter value is not specified in 
%     Spec. It is sufficient to type only the leading characters that 
%     uniquely identify the parameter. Case is ignored for parameter names.
%
% Output:
%   ParameterValue - The value of the named parameter ParameterName extracted
%     from the structure Spec. An empty matrix is returned if the parameter 
%     value is not specified in Spec.
%
% Example:
%   Spec = garchset('P',1,'Q',1);    % Create a GARCH(P = 1 , Q = 1) model.
%      P = garchget(Spec , 'P');     % Extract the order P = 1.
%   
% See also GARCHSET, GARCHFIT, GARCHSIM, GARCHPRED, OPTIMSET, OPTIMGET.

%   Copyright 1999-2002 The MathWorks, Inc.   
%   $Revision: 1.8 $  $Date: 2002/03/11 19:37:14 $

if nargin < 2
  error(' Not enough input arguments.');
end
if nargin < 3
  default = [];
end

if ~isempty(options) & ~isa(options,'struct')
  error(' First argument must be a GARCH specification structure.');
end

if isempty(options)
  o = default;
  return;
end

Names = [
   'Comment     '
   'R           '
   'M           '
   'P           '
   'Q           '
   'Distribution'
   'C           '
   'AR          '
   'MA          '
   'Regress     '
   'K           '
   'GARCH       '
   'ARCH        '
   'FixC        '
   'FixAR       '
   'FixMA       '
   'FixRegress  '
   'FixK        '
   'FixGARCH    '
   'FixARCH     '
   'Display     '
   'MaxFunEvals '
   'MaxIter     '
   'TolFun      '
   'TolCon      '
   'TolX        '];

[m,n] = size(Names);
names = lower(Names);

lowName = lower(name);
j = strmatch(lowName,names);
if isempty(j)               % if no matches
  error(sprintf([ 'Unrecognized property name ''%s''. See GARCHSET for possibilities.'], name));
elseif length(j) > 1        % if more than one match
% 
% Check for any exact matches (in case any names are subsets of others).
%
  k = strmatch(lowName,names,'exact');
  if length(k) == 1
    j = k;
  else
    msg = sprintf('Ambiguous property name ''%s'' ', name);
    msg = [msg '(' deblank(Names(j(1),:))];
    for k = j(2:length(j))'
      msg = [msg ', ' deblank(Names(k,:))];
    end
    msg = sprintf('%s).', msg);
    error(msg);
  end
end

if any(strcmp(fieldnames(options),deblank(Names(j,:))))
  eval(['o = options.' Names(j,:) ';']);
  if isempty(o)
    o = default;
  end
elseif any(strcmp(fieldnames(options.Optimization),deblank(Names(j,:))))
  eval(['o = options.Optimization.' Names(j,:) ';']);
%
% Note that the 'Display', 'MaxFunEvals', 'MaxIter', 'TolFun', 'TolCon', 
% and 'TolX' fields are buried inside the nested structure 'Optimization'
% which is eventually passed to the optimization function FMINCON by the 
% estimation function GARCHFIT. In particular, the 'Display' field in the 
% GARCH Toolbox is meant to allow users to view the optimization process, 
% but differs slightly from the 'Display' field produced by calling 
% OPTIMSET('FMINCON'). The GARCH Toolbox 'Display' field has only 2 options, 
% 'on' and 'off'. These choices are actually mapped to the 2 fields 'Display'
% and 'Diagnostics' of the Optimization Toolbox. This results in an 
% all-or-nothing iterative view of the optimization process. The mapping 
% is shown below.
%
%         GARCH Toolbox         Optimization Toolbox
%          'Display'         'Display'    'Diagnostics'
%         -------------      -----------  --------------
%            'on'             'iter'         'on'
%            'off'            'off'          'off'
%
  if strcmp(lowName,'display') & strcmp(o,'iter')
     o  =  'on';
  end
  if isempty(o)
    o = default;
  end
else
  o = default;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -