methods-volatility: Extract GARCH Model Volatility

Description Usage Arguments Details Methods Note Author(s) Examples

Description

Extracts volatility from a fitted GARCH object.

Usage

1
2
## S3 method for class 'fGARCH'
volatility(object, type = c("sigma", "h"), ...)

Arguments

object

an object of class fGARCH as returned from the function garchFit().

type

a character string denoting if the conditional standard deviations "sigma" or the variances "h" should be returned.

...

additional arguments to be passed.

Details

The function extracts the @volatility from the slots @sigma.t or @h.t of an object of class "fGARCH" as returned by the function garchFit.

The class of the returned value depends on the input to the function garchFit who created the object. The returned value is always of the same class as the input object to the argument data in the function garchFit, i.e. if you fit a "timeSeries" object, you will get back from the function fitted also a "timeSeries" object, if you fit an object of class "zoo", you will get back again a "zoo" object. The same holds for a "numeric" vector, for a "data.frame", and for objects of class "ts", "mts".

In contrast, the slot itself returns independent of the class of the data input always a numceric vector, i.e. the function call rslot(object, "fitted") will return a numeric vector.

Methods

object = "ANY"

Generic function.

object = "fGARCH"

Extractor function for volatility or standard deviation from an object of class "fGARCH".

Note

volatility is a generic function which extracts volatility values from objects returned by modeling functions.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Swiss Pension func Index -
   x = as.timeSeries(data(LPP2005REC))
  
## garchFit
   fit = garchFit(LPP40 ~ garch(1, 1), data = 100*x, trace = FALSE)
   fit
   
## volatility - 
   # Standard Deviation:
   volatility = volatility(fit, type = "sigma")
   head(volatility)
   class(volatility)
   # Variance:
   volatility = volatility(fit, type = "h")
   head(volatility)
   class(volatility)
   
## slot - 
   volatility = slot(fit, "sigma.t")
   head(volatility)
   class(volatility)
   volatility = slot(fit, "h.t")
   head(volatility)
   class(volatility)

Example output

Loading required package: timeDate
Loading required package: timeSeries
Loading required package: fBasics


Rmetrics Package fBasics
Analysing Markets and calculating Basic Statistics
Copyright (C) 2005-2014 Rmetrics Association Zurich
Educational Software for Financial Engineering and Computational Science
Rmetrics is free software and comes with ABSOLUTELY NO WARRANTY.
https://www.rmetrics.org --- Mail to: info@rmetrics.org

Title:
 GARCH Modelling 

Call:
 garchFit(formula = LPP40 ~ garch(1, 1), data = 100 * x, trace = FALSE) 

Mean and Variance Equation:
 LPP40 ~ garch(1, 1)
 [data = 100 * x]

Conditional Distribution:
 norm 

Coefficient(s):
       mu      omega     alpha1      beta1  
0.0491045  0.0083931  0.0881844  0.8016406  

Std. Errors:
 based on Hessian 

Error Analysis:
        Estimate  Std. Error  t value Pr(>|t|)    
mu      0.049104    0.013478    3.643 0.000269 ***
omega   0.008393    0.003493    2.403 0.016268 *  
alpha1  0.088184    0.035316    2.497 0.012524 *  
beta1   0.801641    0.071544   11.205  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Log Likelihood:
 -38.61265    normalized:  -0.1024208 

Description:
 Sun Dec  3 20:08:10 2017 by user: anon 

[1] 0.2805121 0.2674818 0.2608402 0.2645372 0.2603407 0.2558201
[1] "numeric"
[1] 0.07868705 0.07154651 0.06803759 0.06997992 0.06777728 0.06544394
[1] "numeric"
[1] 0.2805121 0.2674818 0.2608402 0.2645372 0.2603407 0.2558201
[1] "numeric"
[1] 0.07868705 0.07154651 0.06803759 0.06997992 0.06777728 0.06544394
[1] "numeric"

fGarch documentation built on Nov. 17, 2017, 2:15 p.m.