fGarch: possible bugs

Yohan Chalabi chalabi at phys.ethz.ch
Tue Feb 12 15:33:58 CET 2008

Hi Michal,

>>>> "MM" == michal miklovic <mmiklovic at yahoo.com>
>>>> on Mon, 11 Feb 2008 11:03:56 -0800 (PST)

   MM> 1. In the summary function, N should be calculated as
   MM> length(object at data) instead of length(object at data) because data
   MM> does not exist (and thus normalised log likelihood is infinity).

yeah, I was supposed to fix that for a long time now. I changed it to
NROW(object at data$Data) to make it more general.

   MM> 2. In plot types 10 and 11 of the plot function, it would
   MM> be better to calculate standardised residuals as sres =
   MM> as.numeric(residuals(x, standardize = TRUE)) and sres2 =
   MM> as.numeric(residuals(x, standardize = TRUE))^2, respectively,
   MM> since the acf function is not able to handle zoo objects while
   MM> fGarch is and the residuals function assigns the same class to
   MM> residuals as has the modeled data.

It is a new feature that garchFit can handle zoo object and we
still need to test it! I made the change to as.matrix() to make
it work with other time series object.

   MM> 3. In the summary function, 'object@' is missing in the command
   MM> to print mean and variance equations.

thanks to point this out !

   MM> 4. There seems to be a problem in the computation of the
   MM> hessian. The default hessian="fda" used with algorithm="nlminb"
   MM> produced a covariance matrix with negative numbers on the
   MM> diagonal. First, I thought this inaccuracy is the price to pay
   MM> for faster computation. The setting hessian="cda" produced a
   MM> covariance matrix with only positive numbers on the diagonal
   MM> but it took longer to calculate the hessian. However, when
   MM> I used algorithm="sqp" both hessian="fda" and hessian="cda"
   MM> produced covariance matrices with negative numbers on the
   MM> diagonal. Therefore, I would like to ask if such a result
   MM> is OK or if there is a bug in the fortran implementation of
   MM> hessian computation.

the fortran routines for the hessian approximation are new and we
are still testing them! I just had a look at the code and there is a
clear problem with hessian="fda". I recommend you to always use
FYI, "cda" is now the default method and we will probably
remove fda before we release the new package.

You can compare the different implementation with

x <- sp500dge[,1]
fit <- garchFit(~garch(1,1), x, al = "mnfb")

RCDAHessian <- .garchRCDAHessian(fit at fit$par, .params, .series)
FCDAHessian <- .garchFCDAHessian(fit at fit$par, .params, .series)
FFDAHessian <- .garchFFDAHessian(fit at fit$par, .params, .series)

thanks for your helpful comments!

More information about the Rmetrics-core mailing list