I have not seen a reply to this post, so I will offer a couple of
comments:
To look for other garch capabilities in R, I tried the following:
library(RSiteSearch)
gch <- RSiteSearch.function('garch')
summary(gch)
HTML(gch)
This found 111 help pages in 18 packages containing the character
string "garch".
I have not tried garch fitting recently, but I recall trying both
"garch" in "tseries" and "garchFit" in
"fGarch" package. If my memory
is correct, I had problems with both but got each to work in cases where
the other didn't.
More directly to your question, I tried the following extension of
an example in the "garch" {tseries} help page:
> n <- 1100
> a <- c(0.1, 0.5, 0.2) # ARCH(2) coefficients
> e <- rnorm(n)
> x <- double(n)
> x <- double(n)
> x[1:2] <- rnorm(2, sd = sqrt(a[1]/(1.0-a[2]-a[3])))
> for(i in 3:n) # Generate ARCH(2) process
+ {
+ x[i] <- e[i]*sqrt(a[1]+a[2]*x[i-1]^2+a[3]*x[i-2]^2)
+ }
> x <- ts(x[101:1100])
> x.arch <- garch(x, order = c(0,2))
> eigen(vcov(x.arch), symmetric=TRUE)
$values
[1] 3.429754e-03 2.114882e-03 8.984913e-05
This last line told me that in this case, the parameters were
reasonably well estimated, because the largest eigenvalue of the
parameter covariance matrix is roughly only 40 times the smallest. If
the covariance matrix were singular, the smallest eigenvalue would be
much closer to 0. In that case, looking at the eigenvector
corresponding to the largest eigenvalue could help you identify a
parameter that could probably be removed from the model without
sacrificing goodness of fit. Of course, this assumes that "vcov"
returns a square symmetric matrix, which it may not if "garch"
declares
false convergence. In a case like that, I'd try simpler models, look at
other functions, etc. Sometimes the data do not provide statistical
leverage to allow certain parameters to be estimated. Then it depends
on what you want: Sometimes you can still get reasonable predictions
even if you can not trust the parameter estimates.
Hope this helps.
Spencer Graves
Pur_045 wrote:> Dear R users,
>
> I am trying to use tseries' garch function in order to determine the
> volatility of a return series generated by quantmod. Here is the code that
I
> am using:
>
>
>> library(quantmod)
>> getSymbols("AAPL")
>>
> convert daily closing prices into continuous log returns
>
>> dret<-dailyReturn(AAPL,type='log')
>>
> check to see that the autocorrelations decay
>
>> acf(dret)
>>
> autocorrelations seem to oscillate to zero
> load package tseries need for garch
>
>> library(tseries)
>>
> run garch on the daily returns
>
>> garch(dret)
>>
>
> When Garch runs there is false convergence, which leads me to distrust the
> results produced from it. Any help or advice on how to remedy this problem
> would be appreciated greatly.
>
> Sean
>
>