Forecasting Stock Market Volatility with Regime-Switching GARCH Models" by J. Marcucci 原文和程序,但是程序有错误,下面是作者Marcucci给的修改意见。
=================================================
Hints for  program 
Instructions for MRS-GARCH programs for the paper  "Forecasting Stock Market Volatility with Regime-Switching GARCH Models" by J. Marcucci (Studies in Nonlinear Dynamics and Econometrics, 2005)
Get the code from the SNDE website (
http://www.bepress.com/snde/vol9/iss4/art6/) at the bottom left of the webpage. Unfortunately the uploaded programs came out with some typos. Below you can find the instructions to slightly change the main program so that it can give you the results without any errors. Please, consider that I ran the programs with Matlab 6 and if you want to "exactly" replicate my results, some could be slightly different. It already happened to other people/students who tried to exactly replicate the results in my paper.
Things to do to have the programs run fine:
There are a couple of typos in the programs downloadable from the SNDE
website that should be fixed. For some unknown reasons a few lines came up
unnecessarily commented or didn't appear at all. Please, follow these instructions and everything should work just fine:
Replace in the main program the following lines after the fmincon call
[...]
% ADDED THE FOLLOWING 2 LINES FOR STD ERR WITH HESSIAN FROM
% OPTIMIZATION. they were disappeared and I don't know why
stder_HESS = sqrt(diag((HESSIAN)^(-1)));
tstat_HESS = parameters./stder_HESS;
[...]
... after se_rob_hess
[...]
%%%%%%%%%%%%%%%%%%%%%%%%%
% ADDED THE FOLLOWING 3 LINES FOR SE_rob_HESS
A2=(1/T)*HESSIAN;
SE_rob_HESS=sqrt((1/T)*diag((A2^(-1))*B*(A2^(-1)))); % hessian from OPTIMIZATION
tstat_HESS_rob = parameters./SE_rob_HESS; % hessian from calculation
[...]
... after tstats
[...]
tstats = parameters./stderrors;
% Printing everything % COMMENTED THE NEXT 5 LINES. THEY WOULD
WRONGLY SET THE GRAD, STDER AND TSTAT TO [] BEFORE STORING THEM!
%GRAD=[];
%stder_HESS=[];
%SE_rob_HESS=[];
%tstat_HESS=[];
%tstat_HESS_rob=[];
If you don't do that, you can get an error because before storing the values, GRAD and the other values are wrongly set to [].
With these corrections, everything should work. Also, you should change the matrix called Parameters in such a way that it can store vectors with different lengths otherwise you will get another error (the dimension mismatch error). It's sufficient to set the number of columns of Parameters to the maximum number of parameters. After fixing this everything should work. Please, email me if it doesn't.
====================================================
这是作者对源程序的修改意见,最后的 change the matrix called Parameters 我没太理解,而且出来的结果都不止该怎么解释,另外,这程序运行的也太慢了,有谁在用这个的时候,有什么问题,交流一下吧!