首页 BEKK-GARCH模型之Matlab编程

BEKK-GARCH模型之Matlab编程

举报
开通vip

BEKK-GARCH模型之Matlab编程BEKK-GARCH模型之Matlab编程 function [parameters, loglikelihood, Ht, likelihoods, stdresid, stderrors, A, B, scores] = full_bekk_mvgarch(data,p,q, BEKKoptions) % PURPOSE: % To Estimate a full BEKK multivariate GARCH model. ****SEE WARNING AT END OF HELP FILE****...

BEKK-GARCH模型之Matlab编程
BEKK-GARCH模型之Matlab编程 function [parameters, loglikelihood, Ht, likelihoods, stdresid, stderrors, A, B, scores] = full_bekk_mvgarch(data,p,q, BEKKoptions) % PURPOSE: % To Estimate a full BEKK multivariate GARCH model. ****SEE WARNING AT END OF HELP FILE**** % % % USAGE: % [parameters, loglikelihood, Ht, likelihoods, stdresid, stderrors, A, B, scores] = full_bekk_mvgarch(data,p,q,options); % % % INPUTS: % data - A t by k matrix of zero mean residuals % p - The lag length of the innovation process % q - The lag length of the AR process % options - (optional) Options for the optimization(fminunc) % % OUTPUTS: % parameters - A (k*(k+1))/2+p*k^2+q*k^2 vector of estimated parameteters. % For any k^2 set of Innovation or AR parameters X, % reshape(X,k,k) will give the correct matrix % To recover C, use ivech(parmaeters(1:(k*(k+1))/2) % loglikelihood - The loglikelihood of the function at the optimum % Ht - A k x k x t 3 dimension matrix of conditional covariances % likelihoods - A t by 1 vector of individual likelihoods % stdresid - A t by k matrix of multivariate standardized residuals % stderrors - A numParams^2 square matrix of robust Standad Errors(A^(-1)*B*A^(-1)*t^(-1)) % A - The estimated inverse of the non-robust Standard errors % B - The estimated covariance of teh scores % scores - A t by numParams matrix of individual scores % % % COMMENTS: % You should multiply the data by a constant so that the min std(data) is at least 10. This will help estimation % % ******************************************************************************* ******** % * THIS FUNCTION INVOLVES ESTIMATING MANY PARAMETERS. THE EXACT NUMBER OF PARAMETERS % * NEEDING TO BE ESTIMATED IS (k*(k+1))/2+pk^2+qk^2. FOR A 5 VARIATE (1,1) MODEL THIS % * 65 PARAMETERS. ESTIMATION CAN TAKE A VERY LONG TIME. A 10 ASset MODEL TOOK 12 % * HOURS ON A PIII-700. % ******************************************************************************* ******** % % % Author: Kevin Sheppard % kevin.sheppard@economics.ox.ac.uk % Revision: 2 Date: 12/31/2001 % need to try and get some smart startgin values if size(data,2) > size(data,1) data=data'; end [t k]=size(data); k2=k*(k+1)/2; scalaropt=optimset('fminunc'); scalaropt=optimset(scalaropt,'TolFun',1e-1,'Display','iter','Diagnostics','on','DiffMaxChange',1e-2) ; startingparameters=scalar_bekk_mvgarch(data,p,q,scalaropt); CChol=startingparameters(1:(k*(k+1))/2); %C=ivech(startingparameters(1:(k*(k+1))/2))*ivech(startingparameters(1:(k*(k+1))/2))'; newA=[]; newB=[]; for i=1:p newA=[newA diag(ones(k,1))*startingparameters(((k*(k+1))/2)+i)]; %#ok end for i=1:q newB=[newB diag(ones(k,1))*startingparameters(((k*(k+1))/2)+i+p)]; %#ok end newA=reshape(newA,k*k*p,1); newB=reshape(newB,k*k*q,1); startingparameters=[CChol;newA;newB]; if nargin<=3 || isempty(BEKKoptions) options=optimset('fminunc'); options.Display='iter'; options.Diagnostics='on'; options.TolX=1e-4; options.TolFun=1e-4; options.MaxFunEvals=5000*length(startingparameters); options.MaxIter=5000*length(startingparameters); else options=BEKKoptions; end parameters=fminunc('full_bekk_mvgarch_likelihood',startingparameters,options,data,p,q,k,k2,t); [loglikelihood,likelihoods,Ht]=full_bekk_mvgarch_likelihood(parameters,data,p,q,k,k2,t); loglikelihood=-loglikelihood; likelihoods=-likelihoods; % Standardized residuals stdresid=zeros(size(data)); for i=1:t stdresid(i,:)=data(i,:)*Ht(:,:,i)^(-0.5); end %Std Errors if nargout>=6 A=hessian_2sided('full_bekk_mvgarch_likelihood',parameters,data,p,q,k,k2,t); h=max(abs(parameters/2),1e-2)*eps^(1/3); hplus=parameters+h; hminus=parameters-h; likelihoodsplus=zeros(t,length(parameters)); likelihoodsminus=zeros(t,length(parameters)); for i=1:length(parameters) hparameters=parameters; hparameters(i)=hplus(i); [HOLDER, indivlike] = full_bekk_mvgarch_likelihood(hparameters,data,p,q,k,k2,t); likelihoodsplus(:,i)=indivlike; end for i=1:length(parameters) hparameters=parameters; hparameters(i)=hminus(i); [HOLDER, indivlike] = full_bekk_mvgarch_likelihood(hparameters,data,p,q,k,k2,t); likelihoodsminus(:,i)=indivlike; end scores=(likelihoodsplus-likelihoodsminus)./(2*repmat(h',t,1)); B=cov(scores); A=A/t; stderrors=A^(-1)*B*A^(-1)*t^(-1); end
本文档为【BEKK-GARCH模型之Matlab编程】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_888153
暂无简介~
格式:doc
大小:23KB
软件:Word
页数:8
分类:互联网
上传时间:2019-02-09
浏览量:233