Reputation: 3195
df=structure(list(X.1 = 1:10, X = c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L), json_data.time.updated = structure(1:10, .Label = c("Jan 19, 2019 15:18:00 UTC",
"Jan 19, 2019 15:19:00 UTC", "Jan 19, 2019 15:51:00 UTC", "Jan 19, 2019 15:52:00 UTC",
"Jan 19, 2019 15:54:00 UTC", "Jan 19, 2019 15:55:00 UTC", "Jan 19, 2019 15:57:00 UTC",
"Jan 19, 2019 15:58:00 UTC", "Jan 19, 2019 16:00:00 UTC", "Jan 19, 2019 16:01:00 UTC"
), class = "factor"), json_data.time.updatedISO = structure(1:10, .Label = c("2019-01-19T15:18:00+00:00",
"2019-01-19T15:19:00+00:00", "2019-01-19T15:51:00+00:00", "2019-01-19T15:52:00+00:00",
"2019-01-19T15:54:00+00:00", "2019-01-19T15:55:00+00:00", "2019-01-19T15:57:00+00:00",
"2019-01-19T15:58:00+00:00", "2019-01-19T16:00:00+00:00", "2019-01-19T16:01:00+00:00"
), class = "factor"), json_data.time.updateduk = structure(1:10, .Label = c("Jan 19, 2019 at 15:18 GMT",
"Jan 19, 2019 at 15:19 GMT", "Jan 19, 2019 at 15:51 GMT", "Jan 19, 2019 at 15:52 GMT",
"Jan 19, 2019 at 15:54 GMT", "Jan 19, 2019 at 15:55 GMT", "Jan 19, 2019 at 15:57 GMT",
"Jan 19, 2019 at 15:58 GMT", "Jan 19, 2019 at 16:00 GMT", "Jan 19, 2019 at 16:01 GMT"
), class = "factor"), code = structure(c(1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L), .Label = "USD", class = "factor"), rate = structure(c(6L,
7L, 10L, 5L, 9L, 8L, 4L, 3L, 1L, 2L), .Label = c("3,734.2833",
"3,734.4950", "3,734.9117", "3,734.9600", "3,735.3200", "3,735.7750",
"3,735.9150", "3,736.0750", "3,736.7717", "3,736.9100"), class = "factor"),
description = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L), .Label = "United States Dollar", class = "factor"),
rate_float = c(3735.775, 3735.915, 3736.91, 3735.32, 3736.7717,
3736.075, 3734.96, 3734.9117, 3734.2833, 3734.495)), class = "data.frame", row.names = c(NA,
-10L))
i want perform GARCH model i try use simple example from help of this library
library("fGarch")
b=garchFit(formula = ~ garch(1, 1), data = df,
init.rec = c("mci", "uev"),
delta = 2, skew = 1, shape = 4,
cond.dist = c("norm", "snorm", "ged", "sged", "std", "sstd",
"snig", "QMLE"),
include.mean = TRUE, include.delta = NULL, include.skew = NULL,
include.shape = NULL, leverage = NULL, trace = TRUE,
algorithm = c("nlminb", "lbfgsb", "nlminb+nm", "lbfgsb+nm"),
hessian = c("ropt"), control = list(),
title = NULL, description = NULL)
garchKappa(cond.dist = c("norm", "ged", "std", "snorm", "sged", "sstd",
"snig"), gamma = 0, delta = 2, skew = NA, shape = NA)
summary(b)
Then i get the error
Error in garchFit(formula = ~garch(1, 1), data = df, init.rec = c("mci", :
Multivariate data inputs require lhs for the formula.
This time series formed by minites date variable is json_data.time.updatedISO metric variable is price rate_float
What does mean this error and how to fix it?
Upvotes: 1
Views: 1556
Reputation: 48241
You specified data = df
, where df
has multiple columns, while the model is just ~ garch(1, 1)
, so there is no way to know which of the variables is supposed to follow this GARCH(1,1). Hence, the errors says that then you need to specify the left hand side. For instance, using
formula = rate_float ~ garch(1, 1), data = df
does the job and also
formula = ~ garch(1, 1), data = df$rate_float
as there is no ambiguity in those cases.
Now with your example data summary(b)
will throw some warnings but that's only due to very few observations; not enough to compute the Standardised Residuals Tests
part.
Upvotes: 1