In the current updated versions I have fixed these and other minor problems.
I have tested both codes (for GARCH models and for MRS-GARCH models)
with different versions of Matlab (2008a, 2009a, 2010a) and
on different platforms (Windows, Linux/Max) and they work fine.
Be aware that, to reduce computing times, for the MRS-GARCH model
you might want to change max_st_v to have a lower number of
starting values and/or change the main loop (line 37)
for errortype = [1 2 4 5];
with for errortype = [k]; where k=(1,2,4,5) to estimate one model at a time.
Updated Matlab main programs:
mrsgarchestfor_con_all.m
garchestfor_con_all.m
%%%%%%%%%%%%
Old instructions to fix the typos in the MRS-GARCH Matlab code
%%%%%%%%%%%%
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.