KURT: In case you have time to look briefly at the 'garch' code, you
might be interested in this example. This email includes a
self-contained example that generates a warning that seems to me
unnecessary: "Warning in sqrt(pred$e) : NaNs produced". This occurs
because pred$e = -0.121. This NaN is immediately replaced by NA in
the line after this 'sqrt(pred$e)'. If the user should be concerned
about this, I suggest you provide a more informative warning.
Otherwise, I suggest you modify the code to eliminate this warning; see
ARUN KUMAR SAHA:
Thanks for the reproducible example. In addition to the warning you
mention, I also got "FALSE CONVERGENCE". To explore this issue, I
looked at the trace output; the following shows the first and the last
The huge negative final value for "RELDF" caught my eye. I don't
know what it means, but it seems strange to me, and could relate in some
way to the "FALSE CONVERGENCE".
To investigate this, I tried, "str(garch1)". This told me that
'garch1' is a list with 10 components, which I also saw on the "garch"
help page. I didn't see anything unusual in summary(garch1) and
plot(garch1). Moreover, garch1$residuals has an NA for the first
observation and no other NAs, which I confirmed using
sum(is.na(garch1$residuals)). However, I am NOT an expert on 'garch';
others might see things that I missed.
To explore this further, I set 'options(warn=2)'; this converts
warnings to errors. I got all the same printed output as before, except
that 'garch' stopped on the 'warning' and failed to return anything.
This told me that the warning is generated in the post-processing of the
fit, preparing the list of 10 components that it normally returns.
Then I listed "garch", set "debug(garch)" and repeated the call to
call to "garch" [after resetting options(warn=1)]. The .C calls to
"fit_garch", "pred_garch", and "ophess_garch" all seemed to work
normally. I then found the following line:
rank <- qr(com.hess$hess, ...)$rank
The proclaimed rank was 3, as it should be. However, to explore this
more, I tried the following:
The ratio of the first to the last eigenevalues is almost 1e9.
Conclusion: This matrix is ill conditioned, consistent with the "FALSE
CONVERGENCE" report. When we round the near-singular eigenvector to 2
significant digits, we get (0, -1, 0.08). This suggests to me that the
second parameter is poorly estimated. However, when I look at
summary(garch1), I see that the third, not the second parameter seems
This looks to me like it does the same thing without generating this
strange warning message. If the warning is needed for some other
purpose, then the code should be modified to more explicitly advice the
user of the concern.
Next, I tried to refit the model without the third, allegedly
garch10 <- garch(dat, 1:0)
Warning: singular information
Maybe the eigenvector analysis was correct, and I misunderstood the
"summary". This led me to try the following:
garch01 <- garch(dat, 0:1)
This did NOT produce a warning.
Next, I tried 'anova':
Error in anova(garch1, garch01) : no applicable method for "anova"
This didn't work, but perhaps I can get the log(likelihoods):