发布网友 发布时间:2022-04-23 08:03
共1个回答
热心网友 时间:2022-06-18 02:29
Seealso========================librarycml;#includecml.ext;cmlset;dsn="garch";depvar={INDEX};indvar={};/*setorderhereforaGARCH(p,q)model*/p=2;q=2;outputfile=garch.outreset;/***ThedatasetisreadinusingloaddbecausetheGARCHlog-likelihood**requirestheentiredatasetandpassingthedatainasamatrix**willensurethatthecompletedatasetwillbepassedtothe**log-likelihoodproc.*/z=loadd(dsn);ifnotscalmiss(indvar);{depvar,dv,indvar,iv}=indices2(dsn,depvar,indvar);else;{depvar,dv}=indices(dsn,depvar);endif;ifscalmiss(dv);errorlog"error:variablenotfoundindataset"$+dsn;end;endif;ifnotscalmiss(indvar);z=z[.,dv]~ones(rows(z),1)~z[.,iv];numx=rows(indvar)+1;_cml_ParNames="CONST"|indvar|"kappa"|(0$+"delta"$+ftocv(seqa(1,1,p),1,0))|(0$+"alpha"$+ftocv(seqa(1,1,q),1,0));else;z=z[.,dv]~ones(rows(z),1);numx=1;_cml_ParNames="CONST"|"kappa"|(0$+"delta"$+ftocv(seqa(1,1,p),1,0))|(0$+"alpha"$+ftocv(seqa(1,1,q),1,0));endif;/***constraints****kappa>0.01,delta.>=0,alpha.>=0,sumc(delta|alpha)cols(z);y[m+1:rows(z),j]=reshape(z[v,j],n+1,m)*a;j=j+1;endo;retp(y);endp;