Extracts fitted values from a fitted GARCH object.
fitted() is a generic function which extracts fitted values
from objects returned by modeling functions.
will show the methods available in the current R session.
The method for
"fGARCH" objects extracts the
value slot from an object of class
"fGARCH" as returned by
The class of the returned value depends on the input to the
garchFit who created the object. The returned
value is always of the same class as the input object to the
data in the function
garchFit, i.e. if
you fit a
"timeSeries" object, you will get back from
fitted also a
if you fit an object of class
"zoo", you will get back
"zoo" object. The same holds for a
vector, for a
"data.frame", and for objects of class
In contrast, the slot itself returns independent of the class
of the data input always a numeric vector, i.e. the function
slot(object, "fitted") will return a numeric vector.
fitted defined in package fGarch:
Extractor function for fitted values.
(GNB) Contrary to the description of the returned value of the
"fGARCH" method, it is always
TODO: either implement the documented behaviour or fix the documentation.
Diethelm Wuertz for the Rmetrics R-port
stopifnot(require("timeSeries")) ## Swiss Pension fund Index - x = as.timeSeries(data(LPP2005REC)) ## garchFit - # Fit LPP40 Bechmark: fit = garchFit(LPP40 ~ garch(1, 1), data = 100*x, trace = FALSE) fit ## fitted - # Fitted values are now a "timeSeries" oject: fitted = fitted(fit) head(fitted) class(fitted) ## slot - # The slot contains a numeric Vector: fitted = slot(fit, "fitted") head(fitted) class(fitted)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.