volatility-methods | R Documentation |
Extracts volatility from a fitted GARCH object.
## S3 method for class 'fGARCH'
volatility(object, type = c("sigma", "h"), ...)
object |
an object of class |
type |
a character string denoting if the conditional standard deviations
|
... |
currently not used. |
volatility
is an S3 generic function for computation of
volatility, see volatility
for the default
method.
The method for "fGARCH"
objects, described here, extracts the
volatility from slot @sigma.t
or @h.t
of an
"fGARCH"
object usually obtained from 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 always contains a numeric vector,
independently of the class of the input data input, i.e. the function
call slot(object, "fitted")
will return a numeric vector.
Methods for volatility
defined in package fGarch:
Extractor function for volatility or standard deviation from
an object of class "fGARCH"
.
(GNB) Contrary to the description of the returned value of the
"fGARCH"
method, it is always "numeric"
.
TODO: either implement the documented behaviour or fix the documentation.
Diethelm Wuertz for the Rmetrics R-port
garchFit
,
class fGARCH
## Swiss Pension fund Index -
stopifnot(require("timeSeries")) # need package 'timeSeries'
x = as.timeSeries(data(LPP2005REC, package = "timeSeries"))
## garchFit
fit = garchFit(LPP40 ~ garch(1, 1), data = 100*x, trace = FALSE)
fit
## volatility -
# Standard Deviation:
vola = volatility(fit, type = "sigma")
head(vola)
class(vola)
# Variance:
vola = volatility(fit, type = "h")
head(vola)
class(vola)
## slot -
vola = slot(fit, "sigma.t")
head(vola)
class(vola)
vola = slot(fit, "h.t")
head(vola)
class(vola)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.