[R-sig-Finance] garchFit and NAs
Spencer Graves
spencer.graves at pdf.com
Sun Jun 4 19:21:18 CEST 2006
You don't provide a simple, self-contained example, so I can't be
certain of what you are seeing. However, I tried a "garchFit" example
in "~/fSeries/demo/xmpDWChapter34.R", as suggested in the "garchFit"
help file, and it seemed to return sensible answers. Then I modified it
with "formula.mean = ~arma(0, 2)" and 'cond.dist="dsged"' as in your
example. That completed in just under 13 minutes, if my memory is
correct. When I tried the same example without the 'cond.dist="dsged"',
it seemed to run forever without making progress. Over an hour later, I
had such trouble killing it that I would up rebooting!
Since the example that ran took almost 13 minutes, I'm not eager to
rerun it. However, as I recall, the example from xmpDWChapter34.R
didn't have the problem you identified, but the "~arma(0, 2)"
modification did. To explore this further, I used "str" to see the
structure of the garchFit output. In that, I found something called
"hessian". If I'm not mistaken, I believe the square roots of the
diagonals of the inverse of "hessian" should be the approximate standard
errors; if not, the difference should be something like a factor of the
standard deviation of the residuals. You can check this for an example
that works. For the "~arma(0, 2)" modification, I computed the
eigenvalues of the "hessian", and found that it was NOT positive
definite, as it should be: Instead it had some positive and some
negative eigenvalues. I'm guessing that this means that the formally
computed approximate covariance matrix might have negative numbers on
its diagonal. If so, this would correspond to imaginary standard errors
and would generate the NAs you reported.
I'm not completely certain how to interpret this in the context of
your application, but I'm guessing that the algorithm is getting stuck
in a saddle-point and is not actually maximizing the likelihood. If you
wanted to pursue this further, you could list the "garchFit" function to
see what it does. It might help to walk through it line-by-line, e.g.,
using "debug" (see, e.g.,
"http://finzi.psych.upenn.edu/R/Rhelp02a/archive/68215.html"). This
will likely consist of a call to an optimizer. You could find that,
then experiment with evaluating the objective function over a moderately
course grid, using e.g., expand.grid to generate a set of points at
which to evaluate the grid, then evaluating the objective function at
each such point in a loop, then studying the results, e.g., using
'lattice' graphics.
I realize this won't solve your problem, but I think you are working
in an area that has not yet been extensively studied. Nevertheless, I
hope this helps.
Spencer Graves
anass.mouhsine at sgcib.com wrote:
> Hi everybody,
>
> When trying to fit an ARMA(0,2)-APARCH(1,1) model to a timeseries, it
> results in the following warning message:
>
> NaNs produced in: sqrt(diag(fit$cvar))
>
> the print function gives the following result
>
> _______________________________________________________________________
> Title:
> GARCH Modelling
>
> Call:
> garchFit(formula.mean = ~arma(0, 2), formula.var = ~aparch(1,
> 1), series = seriemul, cond.dist = "dsged")
>
> Mean and Variance Equation:
> ~arma(0, 2) + ~aparch(1, 1)
>
> Conditional Distribution:
> dsged
>
> Coefficient(s):
> mu ma1 ma2 omega alpha1 gamma1
> -0.478628 0.356290 0.054928 1.472516 0.944778 0.418131
> beta1 delta skew shape
> 0.306527 1.912457 0.541992 1.304578
>
> Error Analysis:
> Estimate Std. Error t value Pr(>|t|)
> mu -0.478628 0.066091 -7.242 4.42e-13 ***
> ma1 0.356290 0.096042 3.710 0.000207 ***
> ma2 0.054928 0.055839 0.984 0.325272
> omega 1.472516 0.223275 6.595 4.25e-11 ***
> alpha1 0.944778 0.213975 4.415 1.01e-05 ***
> gamma1 0.418131 0.094418 4.428 9.49e-06 ***
> beta1 0.306527 NA NA NA
> delta 1.912457 NA NA NA
> skew 0.541992 0.004978 108.879 < 2e-16 ***
> shape 1.304578 NA NA NA
> ---
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> Log Likelihood:
> 764.6944 normalized: 2.044638
> _______________________________________________________________________
>
> My question is:
> --> How are these NaNs produced?
> --> How can we read and interpret the NAs in the result?
>
> Thank you in advance for your help,
>
> Anass
>
> *************************************************************************
> This message and any attachments (the "message") are confide...{{dropped}}
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
More information about the R-SIG-Finance
mailing list