Arun Kumar Saha wrote:> Dear all R-users,
>
> I have a GARCH related query. Suppose I fit a GARCH(1,1) model on a
> dataframe dat
>
>
>>garch1 = garch(dat)
>>summary(garch1)
>
> Call:
> garch(x = dat)
>
> Model:
> GARCH(1,1)
>
> Residuals:
> Min 1Q Median 3Q Max
> -4.7278 -0.3240 0.0000 0.3107 12.3981
>
> Coefficient(s):
> Estimate Std. Error t value Pr(>|t|)
> a0 1.212e-04 2.053e-06 59.05 <2e-16 ***
> a1 1.001e+00 4.165e-02 24.04 <2e-16 ***
> b1 2.435e-15 1.086e-02 2.24e-13 1
> ---
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05
'.' 0.1 ' ' 1
>
> Diagnostic Tests:
> Jarque Bera Test
>
> data: Residuals
> X-squared = 54480.76, df = 2, p-value < 2.2e-16
>
> 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?
This is less a question about GARCH and more a question about how R works
(which I know is true because I didn't know what GARCH was when I read the
question and I still don't but I can provide you a usable answer).
You can use the str() function to see the structure of an object in R:
> garch1.summary <- summary(garch1)
> str(garch1.summary)
List of 6
$ residuals: Time-Series [1:999] from 2 to 1000: 0.206 0.709 0.476
-0.291 -1.676 ...
..- attr(*, "na.removed")= int 1
$ coef : num [1:3, 1:4] 0.0799 0.6287 0.2118 0.0110 0.0755 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:3] "a0" "a1" "b1"
.. ..$ : chr [1:4] " Estimate" " Std. Error" " t
value" "Pr(>|t|)"
$ call : language garch(x = x, order = c(1, 1))
$ order : Named num [1:2] 1 1
..- attr(*, "names")= chr [1:2] "p" "q"
$ j.b.test :List of 5
..$ statistic: Named num 0.468
.. ..- attr(*, "names")= chr "X-squared"
..$ parameter: Named num 2
.. ..- attr(*, "names")= chr "df"
..$ p.value : Named num 0.791
.. ..- attr(*, "names")= chr "X-squared"
..$ method : chr "Jarque Bera Test"
..$ data.name: chr "Residuals"
..- attr(*, "class")= chr "htest"
$ l.b.test :List of 5
..$ statistic: Named num 1.01
.. ..- attr(*, "names")= chr "X-squared"
..$ parameter: Named num 1
.. ..- attr(*, "names")= chr "df"
..$ p.value : num 0.316
..$ method : chr "Box-Ljung test"
..$ data.name: chr "Squared.Residuals"
..- attr(*, "class")= chr "htest"
- attr(*, "class")= chr "summary.garch"
From this you can see that there is a "coef" list member
that contains the information you are after:
> garch1.summary$coef
Estimate Std. Error t value Pr(>|t|)
a0 0.07989234 0.01104719 7.231912 4.762857e-13
a1 0.62870916 0.07551333 8.325804 0.000000e+00
b1 0.21184013 0.05384033 3.934599 8.333558e-05
this is apparently a matrix, so try matrix notation:
> garch1.summary$coef[,4]
a0 a1 b1
4.762857e-13 0.000000e+00 8.333558e-05
or
> garch1.summary$coef[1,4]
[1] 4.762857e-13
Having said all that, this solution depends on implementation details
of the innards of the relevant objects, and in general if accessor
functions are available they should be used instead... but in this
case such accessors don't seem to be available.
> help.search("garch-methods", package="tseries")
--
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live
Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k