## garchFit -
fit = garchFit(~garch(1, 1), data = garchSim(), trace = FALSE)
## formula -
formula(fit)
## A Bivariate series and mis-specified formula:
x = garchSim(n = 500)
y = garchSim(n = 500)
z = cbind(x, y)
colnames(z)
class(z)
if (FALSE) {
garchFit(z ~garch(1, 1), data = z, trace = FALSE)
}
# 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,]
if (FALSE) {
garchFit(x ~garch(1, 1), data = z, trace = FALSE)
}
# 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,]
if (FALSE) {
garchFit(x ~ garch(1, 1), data = z.mat, trace = FALSE)
}
# Again the error will be noticed:
# Error in .garchArgsParser(formula = formula, data = data, trace = FALSE) :
# Formula and data units do not match
Run the code above in your browser using DataLab