I have been working with the two packages fGarch and rugarch to fit a
GARCH(1,1) model to my exchange rate time series consisting of 3980 daily
log-returns.
Code:
fx_rates <- data.frame(read.csv("WMCOFixingsTimeSeries.csv", header=T,
sep=";", stringsAsFactors=FALSE))
EURUSD <- ts(diff(log(fx_rates$EURUSD), lag=1), frequency=1)
#GARCH(1,1)
library(timeSeries)
library(fGarch)
x <- EURUSD
fit <- garchFit(~garch(1,1), data=x, cond.dist="std", trace=F,
include.mean=F)
fit at fit$matcoef
library(rugarch)
spec <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1,
1)),
mean.model=list(armaOrder=c(0,0), include.mean=F),
distribution.model="std")
gfit <- ugarchfit(spec, x, solver="hybrid",
fit.control=list(stationarity=1))
gfit at fit$matcoef
The two models show the following results:
fGarch:
fit at fit$matcoef
Estimate Std. Error t value Pr(>|t|)
omega 1.372270e-07 6.206406e-08 2.211054 2.703207e-02
alpha1 2.695012e-02 3.681467e-03 7.320484 2.471356e-13
beta1 9.697648e-01 3.961845e-03 244.776060 0.000000e+00
shape 8.969562e+00 1.264957e+00 7.090804 1.333378e-12
rugarch:
gfit at fit$matcoef
Estimate Std. Error t value Pr(>|t|)
omega 1.346631e-07 3.664294e-07 0.3675008 7.132455e-01
alpha1 2.638156e-02 2.364896e-03 11.1554837 0.000000e+00
beta1 9.703710e-01 1.999087e-03 485.4070764 0.000000e+00
shape 8.951322e+00 1.671404e+00 5.3555696 8.528729e-08
I have found a thread
http://r.789695.n4.nabble.com/Comparison-between-rugarch-and-fGarch-td4683770.html
on why the estimates are not identical, however I can't figure out the big
difference in the standard errors and therethrough the different
significancs for omega. Furthermore, I was not able to detect how the
standard errors are computed by investigating the source code of the rugarch
package. The difference is not caused by the stationarity constraint as
omega remains insignificant. Does anybody know how the standard errors of
the estimated parameters (omega, alpha, beta and nu (shape)) are calculated?
If possible I would like to proceed with the rugarch package, as I wish to
forecast volatility and determine VaR measures. rugarch has shown to a very
profound package for this intentions. Thank you for your support.
--
View this message in context: http://r.789695.n4.nabble.com/Different-significance-of-parameter-estimation-in-GARCH-models-using-r-rugarch-fGarch-package-tp4687664.html
Sent from the Rmetrics mailing list archive at Nabble.com.
Different significance of parameter estimation in GARCH models using r (rugarch & fGarch package)
4 messages · philippe, Alexios Ghalanos
1. Section 3.1 of the vignette discusses robust standard error calculation. The non-robust version is calculated using the hessian function from the numDeriv package. A search of the package source R folder for terms "hessian" or "grad" will surely reveal where to look. 2. Method vcov can be used to extract the parameter covariance matrix (with option to extract the robust one as well). 3. Try using scaling (fit.control) or increasing the default tolerance of the solver. 4. There is no point supplying code for the dataset when no one else has access to that (so this is not really a reproducible example). 5. You did not report the log likelihood of the two estimated models, so I cannot gauge if rugarch may have stopped at a non global optimum, in which case (3) may be useful. Alexios
On 27 Mar 2014, at 03:18 PM, philippe <philippe.kappeler at hotmail.com> wrote:
I have been working with the two packages fGarch and rugarch to fit a
GARCH(1,1) model to my exchange rate time series consisting of 3980 daily
log-returns.
Code:
fx_rates <- data.frame(read.csv("WMCOFixingsTimeSeries.csv", header=T,
sep=";", stringsAsFactors=FALSE))
EURUSD <- ts(diff(log(fx_rates$EURUSD), lag=1), frequency=1)
#GARCH(1,1)
library(timeSeries)
library(fGarch)
x <- EURUSD
fit <- garchFit(~garch(1,1), data=x, cond.dist="std", trace=F,
include.mean=F)
fit at fit$matcoef
library(rugarch)
spec <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1,
1)),
mean.model=list(armaOrder=c(0,0), include.mean=F),
distribution.model="std")
gfit <- ugarchfit(spec, x, solver="hybrid",
fit.control=list(stationarity=1))
gfit at fit$matcoef
The two models show the following results:
fGarch:
fit at fit$matcoef
Estimate Std. Error t value Pr(>|t|)
omega 1.372270e-07 6.206406e-08 2.211054 2.703207e-02
alpha1 2.695012e-02 3.681467e-03 7.320484 2.471356e-13
beta1 9.697648e-01 3.961845e-03 244.776060 0.000000e+00
shape 8.969562e+00 1.264957e+00 7.090804 1.333378e-12
rugarch:
gfit at fit$matcoef
Estimate Std. Error t value Pr(>|t|)
omega 1.346631e-07 3.664294e-07 0.3675008 7.132455e-01
alpha1 2.638156e-02 2.364896e-03 11.1554837 0.000000e+00
beta1 9.703710e-01 1.999087e-03 485.4070764 0.000000e+00
shape 8.951322e+00 1.671404e+00 5.3555696 8.528729e-08
I have found a thread
http://r.789695.n4.nabble.com/Comparison-between-rugarch-and-fGarch-td4683770.html
on why the estimates are not identical, however I can't figure out the big
difference in the standard errors and therethrough the different
significancs for omega. Furthermore, I was not able to detect how the
standard errors are computed by investigating the source code of the rugarch
package. The difference is not caused by the stationarity constraint as
omega remains insignificant. Does anybody know how the standard errors of
the estimated parameters (omega, alpha, beta and nu (shape)) are calculated?
If possible I would like to proceed with the rugarch package, as I wish to
forecast volatility and determine VaR measures. rugarch has shown to a very
profound package for this intentions. Thank you for your support.
--
View this message in context: http://r.789695.n4.nabble.com/Different-significance-of-parameter-estimation-in-GARCH-models-using-r-rugarch-fGarch-package-tp4687664.html
Sent from the Rmetrics mailing list archive at Nabble.com.
_______________________________________________ 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.
Thank you for your swift response. I have attached the link with the fx rates: https://drive.google.com/folderview?id=0BwSzkfw3xUH3REsxRHprZEU1R00&usp=sharing <https://drive.google.com/folderview?id=0BwSzkfw3xUH3REsxRHprZEU1R00&usp=sharing> Scaling or increasing the tolerance of the solver did not work out so far. Philippe -- View this message in context: http://r.789695.n4.nabble.com/Different-significance-of-parameter-estimation-in-GARCH-models-using-r-rugarch-fGarch-package-tp4687664p4687673.html Sent from the Rmetrics mailing list archive at Nabble.com.
ok, found the solution...the default control options for the hessian
routine had a zero tolerance value of sqrt(.Machine$double.eps/7e-7)
which is obviously not sufficient for parameters like omega which are
much smaller.
Fixed and committed. Please download latest from its bitbucket
development repository using the following commands:
library(devtools)
install_bitbucket("rugarch","alexiosg")
-Alexios
On 27/03/2014 16:19, philippe wrote:
Thank you for your swift response. I have attached the link with the fx rates: https://drive.google.com/folderview?id=0BwSzkfw3xUH3REsxRHprZEU1R00&usp=sharing <https://drive.google.com/folderview?id=0BwSzkfw3xUH3REsxRHprZEU1R00&usp=sharing> Scaling or increasing the tolerance of the solver did not work out so far. Philippe -- View this message in context: http://r.789695.n4.nabble.com/Different-significance-of-parameter-estimation-in-GARCH-models-using-r-rugarch-fGarch-package-tp4687664p4687673.html Sent from the Rmetrics mailing list archive at Nabble.com.
_______________________________________________ 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.