[R-SIG-Finance] Fitting Arma-garch models to my troublesome data
Lasse Thorst
thorstlasse at gmail.com
Wed Nov 12 15:29:55 CET 2014
Hi
I am trying to fit a number of ARMA-GARCH models til my data. I have no
trouble using the various GARCH-models from the rugarch package, when done
on simple data-sets. But when I try to do it on my own data - I run into a
lot of different errors. Amongst others: convergency, hessian-errors and
more.
I have google'd all day and been looking at the advice for the solvers,
solver.control and fit.control, but haven't found anything that has helped
me. I've been over the vignette & introduction, but I feel I am fumbling
blind. It might be I need to do something with my data, or I am just
missing a simple model-change.
My data can be found here & or downloaded via the code-example
https://dl.dropboxusercontent.com/u/4877253/df.csv
#R-code example:
require(repmis) # For data-download
require(rugarch)
URL <- "https://dl.dropboxusercontent.com/u/4877253/df.csv"
# Download data
df <- repmis::source_data(URL, sep = ";", header = TRUE)
x = df$x
ar = as.matrix(df[, -1])
#Example 1
spars = list(mu = 13, ar1 = 0.98, omega = 0.29,
alpha1 = 0.73, beta1 = 0.27)
spec = ugarchspec(
variance.model = list(model = "sGARCH", garchOrder = c(1,1)),
mean.model = list(armaOrder = c(1,1), include.mean = TRUE, archm=TRUE,
external.regressors = ar),
distribution.model = "sstd", start.pars = spars)
sgarch.fit1 = ugarchfit(data = x, spec = spec, solver = "hybrid")
#Warning message:
#In arima0(data, order = c(modelinc[2], 0, modelinc[3]), include.mean =
modelinc[1], :
# possible convergence problem: optim gave code = 1
# Example 2:
spars = list(mu = 11.05, ar1 = 0.98, omega = 0.36,
+ alpha1 = 0.73, beta1 = 0.0001) # opdateret parameter
spec = ugarchspec(
+ variance.model = list(model = "gjrGARCH", garchOrder = c(2 ,2)),
+ mean.model = list(armaOrder = c(1, 2), include.mean = FALSE, archm=TRUE,
+ external.regressors = ar),
+ distribution.model = "sstd", start.pars = spars)
gjrgarch.fit = ugarchfit(data = x, spec = spec, solver = "hybrid")
# Error in optim(init[mask], arma0f, method = "BFGS", hessian = TRUE,
control = optim.control) :
non-finite finite-difference value [1]
# If I add include.mean = TRUE I get :
Error in solve.default(res$hessian * length(x)) :
Lapack routine dgesv: system is exactly singular: U[2,2] = 0
Regards
[[alternative HTML version deleted]]
More information about the R-SIG-Finance
mailing list