[R] Problem with garchFit function in fSeries
Spencer Graves
spencer.graves at pdf.com
Sun Jul 9 17:48:50 CEST 2006
Without a self-contained example, it's difficult to say for sure.
However, this looks to me like false convergence: garchFit uses a
nonlinear iteration to try to maximize the likelihood by minimizing
(-log(likelihood)). The matrix of second partial derivatives of
(-log(likelihood)) provide an approximation to the covariance matrix of
the parameter estimates. If it stops before appropriate convergence,
some of the diagonal elements of this matrix might be negative. When I
listed 'garchFit' just now, I found that the line before the one
generating your warning was as follows:
fit$cvar = solve(fit$hessian)
This seems consistent with what I just said.
If you want to try to get around this, I suggest you start by
focusing on the argument 'control' mentioned on the help page for
'garchFit'. If you follow that through the help pages for 'nlminb' and
'optim', plus possibly 'demo/xmpDWChapter34.R' mentioned in the
examples, I believe you will likely find a way to get around that.
First, however, I suggest you plot the data series and take a careful
look at it, if you haven't already.
Also, you say it worked fine for you with only 1000 of the 1600
observations. Was that observations 1:1000 of this same series? If
yes, did you try also observations 601:1600? I just wonder if the data
in the last 600 observations behave rather differently from the first
1000?
Hope this helps.
Spencer Graves
p.s. If you'd like further assistance from the listserve, please submit
another post. Before you do, however, I suggest you read the posting
guide! "www.R-project.org/posting-guide.html", especially the part about
including a simple, self-contained example. I would NOT recommend you
include 1600 observations in an email like this. However, with common R
download commands, you might be able to describe in a couple of commands
how to get the data, then how you subsetted it, etc.
Ivan Kalafatic wrote:
> I used garchFit function to fit 1600 observations of EURO/USD 2-day returns
> in GARCH(1,1) model.
> As part of the summary I got warning message:
> NaNs produced in: sqrt(diag(fit$cvar))
>
> And didn't get any estimates for 3 params' std.error, t value or
> probability:
>
> Error Analysis:
> Estimate Std. Error t value Pr(>|t|)
> mu -0.004827 0.020141 -0.240 0.811
> ar1 0.010311 0.026978 0.382 0.702
> omega 0.073813 NA NA NA
> alpha1 0.100000 NA NA NA
> beta1 0.800000 NA NA NA
>
> When I reduced the sample size to 1000 observations output was ok.
> Can anyone help? What does this mean? What can be the cause of NA values?
>
> Thank you,
> Ivan
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list