Description Details Methods Note Author(s) Examples
Extracts formula from a formula GARCH object.
The function extracts the @formula
expression slot from
an object of class "fGARCH"
as returned by the function
garchFit
.
Note, the returned formula has always a left hand
side. If the argument data
was an univariate time series
and no name was specified to the series, then the left hand side
has assigned the name of the data.set. In the multivariate case
the rectangular data
object must always have column names,
otherwise the fitting will be stopped and you get the error
message
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.
Generic function.
Extractor function for formula expression.
formula
is a generic function which extracts the formula
expression from objects returned by modeling functions.
Diethelm Wuertz for the Rmetrics Rport.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42  ## garchFit 
fit = garchFit(~garch(1, 1), data = garchSim())
## formula 
formula(fit)
## A Bivariate series and misspecified formula:
x = garchSim(n = 500)
y = garchSim(n = 500)
z = cbind(x, y)
colnames(z)
class(z)
## Not run:
garchFit(z ~garch(1, 1), data = z, trace = FALSE)
## End(Not run)
# Returns:
# Error in .garchArgsParser(formula = formula, data = data, trace = FALSE) :
# Formula and data units do not match.
## Doubled column names in data set  formula can't fit:
colnames(z) < c("x", "x")
z[1:6,]
## Not run:
garchFit(x ~garch(1, 1), data = z, trace = FALSE)
## End(Not run)
# Again the error will be noticed:
# Error in garchFit(x ~ garch(1, 1), data = z) :
# Column names of data are not unique.
## Missing column names in data set  formula can't fit:
z.mat < as.matrix(z)
colnames(z.mat) < NULL
z.mat[1:6,]
## Not run:
garchFit(x ~ garch(1, 1), data = z.mat, trace = FALSE)
## End(Not run)
# Again the error will be noticed:
# Error in .garchArgsParser(formula = formula, data = data, trace = FALSE) :
# Formula and data units do not match

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs in the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.