[R] fSeries
Diethelm Wuertz
wuertz at itp.phys.ethz.ch
Tue Dec 13 22:43:52 CET 2005
Braesch Lucas wrote:
>I'm trying to use garchFit from fSeries, with Student or Skewed Student conditionnal distribution. Let's say that eps (vector) is my series of daily log-returns:
>
>data(EuStockMarkets)
>eps = diff(log(EuStockMarkets[,"CAC"]))
>
>library(fSeries)
>g = garchFit(series = eps, formula.var = ~garch(2,2), cond.dist = "dstd")
>s = g at fit$series
>
>All the coefficients are ok (checked with SAS 9.1) except nu (degrees of freedom of the student) and the log-likelyhood. I've really checked everything and can't find the estimated series sigma (volatility) and eta, such that eps = sigma * eta and eta is centered and reduced... I've tryed combinations of all s$x,s$h,s$z and nothing looks looks correct.
>
>Also, is it possible to fit EGARCH and TGARCH with R ?
>
>If anyone ever managed to make it work, i'd be grateful ;-)
>
Do you think, that SAS is right? - Please can you post the results from SAS?
This is a good example which shows what can go wrong in GARCH Modelling!!!
First simulate with Rmetrics:
data(EuStockMarkets)
eps = as.vector(diff(log(EuStockMarkets[,"CAC"])))
var(x)
# Important - Maybe you have a scale problem in optimization because
# your variance paramater is so small compared with the other parameters!
# Thus, multiply with 100:
x = 100* as.vector(eps)
# Rmetrics:
garchFit(formula.mean = ~arma(0,0), formula.var = ~garch(2,2), cond.dist
= "dstd")
# mu omega alpha1 alpha2 beta1 beta2
shape
# 0.0523284 0.0421556 0.0455789 0.0000010 0.8678519 0.0523520
7.9870453
# Now I simulated with Ox and S-Plus, in both cases I found convergence
problems.
# The reason may be that your model is not a GARCH(2,2) it's a
GARCH(1,2) model!
# Now Try:
garchFit(formula.mean = ~arma(0,0), formula.var = ~garch(1,2), cond.dist
= "dstd")
# mu omega alpha1 beta1 beta2 shape
# 0.0523284 0.0421547 0.0455790 0.8678688 0.0523368 7.9870458
# Great, we get the same result!
# Now, try Ox/G at RCH, the result is:
Coefficient Std.Error t-value t-prob
Cst(M) 0.052328 0.023772 2.201 0.0278
Cst(V) 0.042139 0.027597 1.527 0.1269
ARCH(Alpha1) 0.045604 0.025377 1.797 0.0725
GARCH(Beta1) 0.867664 0.64808 1.339 0.1808
GARCH(Beta2) 0.052555 0.60865 0.08635 0.9312
Student(DF) 7.983069 1.1553 6.910 0.0000
# Now try S-Plus/Finmetrics, the result is:
Conditional Distribution: t
with estimated parameter 7.937377 and standard error 1.148712
Value Std.Error t value Pr(>|t|)
C 0.05311 0.02377 2.2344 0.01279
A 0.04355 0.02818 1.5455 0.06120
ARCH(1) 0.04653 0.02553 1.8230 0.03423
GARCH(1) 0.85512 0.64209 1.3318 0.09155
GARCH(2) 0.06303 0.60239 0.1046 0.45834
# So Rmetrics, Ox, and S-Plus are in agreement!!!
# What is with SAS? Please give us the results for GARCH(1,2)
# and GARCH(2,2)!
# Please note, garchFit() from Rmetrics is still in
# testing phase. An updated version is just under preparation.
Diethelm Wuertz
>
>
>
More information about the R-help
mailing list