[Rd] [R] GARCH

Gabor Grothendieck ggrothendieck at gmail.com
Sat Jun 24 06:47:11 CEST 2006


Looks like tseries needs a coef.summary.garch method or perhaps
stats needs a coef.default method.

On 6/24/06, Spencer Graves <spencer.graves at pdf.com> wrote:
>          I'll outline here how you can solve this kind of problem, using the
> first example in the 'garch' help page:
>
> library(tseries)
>      n <- 1100
>      a <- c(0.1, 0.5, 0.2)  # ARCH(2) coefficients
>      e <- rnorm(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))  # Fit ARCH(2)
> (sum.arch <- summary(x.arch))
> <snip>
>     Estimate  Std. Error  t value Pr(>|t|)
> a0   0.09887     0.01013    9.764  < 2e-16 ***
> a1   0.43104     0.05276    8.170 2.22e-16 ***
> a2   0.31261     0.05844    5.350 8.82e-08 ***
> <snip>
>
>          Then I tried 'str(sum.arch)'.  This told me it is a list with 6
> components, and the one I want is named 'coef'.  This led me to examine
> 'sum.arch$coef', which includes the desired numbers.  Moreover,
> 'class(sum.arch$coef)' told me this is a 'matrix'.  This information
> suggests that the following might be what you requested:
>
>  sum.arch$coef[, "Pr(>|t|)"]
>           a0           a1           a2
> 0.000000e+00 2.220446e-16 8.815239e-08
>
>          Hope this helps.
>          Spencer Graves
>
> Jeff Newmiller wrote:
> > Prof Brian Ripley wrote:
> >> Why do you think
> >>
> >>> help.search("garch-methods", package="tseries")
> >> finds accessor functions?  That is notation for S4 methods, and "garch"
> >> is an S3 class so there will be none.  Here there _is_ an accessor,
> >> coef(), and you can find that there is by
> >
> > Probably because I used it, found a mention of various extraction functions
> > including coef(), and could not find a way to access "Pr(>|t|)" using
> > coef(). Nor have I had luck with
> >   help.search("summary.garch", package="tseries")
> >
> > Possibly also because I have not yet figured out the difference between
> > S4 and S3 methods, but since the result of my  help.search call displayed S3
> > functions I don't see how knowing this difference would have helped.
> >
> >>> methods(class="garch")
> >> [1] coef.garch*      fitted.garch*    logLik.garch*    plot.garch*
> >> [5] predict.garch*   print.garch*     residuals.garch* summary.garch*
> >>
> >>    Non-visible functions are asterisked
> >>
> >> Note though that inherited methods might be relevant too (e.g. default
> >> methods) and indeed it seems that here the default method for coef would
> >> work just as well.
> >
> > Given Arun Kumar Saha's question...
> >
> >  > > Now I want to store the value of Pr(>|t|) for coefficient a0, a1,
> >  > > and b1, and also values of these coefficients, so that I can use
> >  > > them in future separately. I know that I can do it for coefficients
> >  > > by using the command:
> >  > > coef(garch1)["a0"] etc, but not for Pr(>|t|). Can anyone please
> >  > > tell me how to do this?
> >
> > ... I don't see how coef() helps because I have yet to figure out how
> > to use coef() (or any other accessor) to find " Std. Error" of the
> > coefficient, much less "Pr(>|t|)". summary.garch seems to have only a
> > print method, with no accessors at all. Can you offer a solution?
> >
>
> ______________________________________________
> 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-devel mailing list