Bug with residuals?
Yohan Chalabi
chalabi at phys.ethz.ch
Wed Sep 9 00:59:04 CEST 2009
>>>> "DMDL" == David Morton de Lachapelle <morton.david at gmail.com>
>>>> on Mon, 7 Sep 2009 19:41:30 +0200
Hi David,
DMDL> require(fGarch)
DMDL> x <- rnorm(200)
rnorm(200) should not be used to compare different garch "solver"
because there is no garch effect to be filtered in white noise. The
optimization will most likely fail.
In the output of 'garchFit' and 'garch', you should see at least one of
the parameters reaching its lower bound 0.
As a side note, 200 points is very short in estimating garch models.
try your example with the 'dem2gbp' dataset included in 'fGarch' :
x <- dem2gbp[,1] # note the subset because garch()
# does not support data.frame argument.
DMDL> g <- garchFit(formula ~ garch(1,1), x, include.mean = FALSE,
DMDL> trace =
DMDL> FALSE)
DMDL> abs( residuals(g) ) - abs(x)
DMDL>
DMDL> In fact, in general it outputs data +- mu. On the other
DMDL> hand, the
DMDL> output of
In your case, garch(1,1) with no mean, the residuals are the data
itself.
abs( residuals(g) ) - abs(x)
should be equal to zero
DMDL>
DMDL> residuals(g, standard = TRUE)
this gives the standardized residuals (eps_t / sigma_t) which
correspond to the output of the default 'residuals' methods in
'tseries'.
DMDL>
DMDL> looks more familiar, as it resembles other residuals:
DMDL>
DMDL> require(tseries)
DMDL> residuals(garch(x,trace=FALSE))
HTH,
Yohan
--
PhD student
Swiss Federal Institute of Technology
Zurich
www.ethz.ch
More information about the Rmetrics-core
mailing list