[R-SIG-Finance] Fitting Arma-garch models to my troublesome data
alexios ghalanos
alexios at 4dscape.com
Wed Nov 12 15:58:56 CET 2014
Did you not find the advice on "scale" in the fit.control helpful?
I've had no problem running this:
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 = "jsu")
sgarch = ugarchfit(data = x, spec = spec, solver = "solnp",
fit.control=list(scale=1), solver.control=list(trace=1))
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu 9.440662 0.594724 15.87402 0.000000
ar1 0.980182 0.002772 353.61037 0.000000
ma1 0.243507 0.008625 28.23321 0.000000
archm 0.042695 0.013885 3.07503 0.002105
mxreg1 0.287222 0.018214 15.76936 0.000000
mxreg2 0.022504 0.011017 2.04264 0.041088
mxreg3 0.004379 0.011141 0.39307 0.694265
mxreg4 0.008912 0.006249 1.42622 0.153806
mxreg5 0.005079 0.007043 0.72115 0.470820
mxreg6 0.068634 0.015403 4.45595 0.000008
mxreg7 -0.001836 0.004814 -0.38149 0.702839
mxreg8 0.177037 0.022257 7.95403 0.000000
mxreg9 0.055238 0.016080 3.43516 0.000592
mxreg10 0.018226 0.014779 1.23328 0.217471
mxreg11 0.023172 0.016010 1.44734 0.147801
mxreg12 0.015853 0.008644 1.83391 0.066667
omega 0.300693 0.018851 15.95095 0.000000
alpha1 0.784377 0.033382 23.49677 0.000000
beta1 0.214623 0.014414 14.88955 0.000000
skew 0.027718 0.012451 2.22605 0.026011
shape 0.975472 0.013111 74.40263 0.000000
LogLikelihood : -24841.95
Better yet, read up on the component GARCH model model (in the vignette
and various blog posts) and why, for such a long timeseries, it MAY be
better.
spec = ugarchspec(
variance.model = list(model = "csGARCH", garchOrder = c(1,1)),
mean.model = list(armaOrder = c(1,1), include.mean = TRUE, archm=TRUE,
external.regressors = ar), distribution.model = "jsu")
csgarch = ugarchfit(data = x, spec = spec, solver = "solnp",
fit.control=list(scale=1), solver.control=list(trace=1))
Alexios
PS I've used the jsu distribution as it is faster and in my experience
provides an excellent choice for financial return modelling. See the
skdomain function or the 'Distribution Functions' section of this blog post:
http://unstarched.net/2013/02/27/whats-new-in-rugarch-ver-1-01-5/
On 12/11/2014 14:29, Lasse Thorst wrote:
> 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]]
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>
>
More information about the R-SIG-Finance
mailing list