[R-SIG-Finance] rugarch and fGarch
alexios ghalanos
alexios at 4dscape.com
Tue Jun 12 11:07:40 CEST 2012
1. Please examples with reproducible data for such a detailed question.
SPX.log.ret is not a commom data object found in any of the packages I
know of.
2. How is the significance much lower? Looking at the Pr(>|t|) column
they both look very significant across all parameters. The fact that the
robust s.e. have NaN means that the robust hessian could not be
calculated indicating that you need to tune the solver/use scaling (set
'fit.control=list(scale=1)'). Looking at the results, this is likely
because of the 'gamma' parameter hitting its upper limit.
3. This is a rolling out of sample forecast which means that you are
getting rolling estimates using 100 out of sample data points from the
end of your dataset. As to the "expected" vol in 21 days ROLLING 1 day
at a time, 'n.ahead=21', you need to pass this argument to the
as.data.frame method or better still use:
'sigma=as.data.frame(volforecast, which = "sigma")'. This will be
reverting to its long run mean. I really don't know what you expect as
being reasonable or not.
-Alexios
On 12/06/2012 08:49, Belgarath wrote:
> Dear All,
>
> first of all thanks for the great package!
>
> I'm trying to get volatility forecasts. So I tried a couple of packages and
> I really like the roll functionality provided within the rugarch package but
> am finding inconsistencies with the results from two garch packages:
>
> 1)
> I run
>
> GA3=garchFit(formula=~arma(1,0)+aparch(1,1),data=SPX.log.ret,cond.dist="sstd")
>
> modeltofit=ugarchspec(variance.model = list(model = "apARCH", garchOrder =
> c(1, 1),
> submodel = NULL, external.regressors = NULL, variance.targeting = FALSE),
> mean.model = list(armaOrder = c(1, 0), include.mean = TRUE, archm = FALSE,
> archpow = 1, arfima = FALSE, external.regressors = NULL, archex = FALSE),
> distribution.model = "sstd", start.pars = list(), fixed.pars = list())
> GAA3=ugarchfit(spec=modeltofit,data=SPX.log.ret)
>
> As you can see from the results below the parameter coefficients are
> different but similar but the significance is much lower for rugarch. Do you
> know why?
>
> 2)
> I then run
>
> volforecast=ugarchroll(spec=modeltofit, data = last(SPX.log.ret,550),
> n.ahead = 42,
> forecast.length = 100, refit.every = 25)
> sigma=as.data.frame(volforecast)
> sigmat<- as.POSIXct(strptime(sigma[,1],format="%Y-%m-%d"))
> sigma2<- xts(sigma[,3],order.by=sigmat)*100*sqrt(252)
>
> And the results seems to me too low to represent the expected vol in 21
> days. Could you please point me in the right direction?
>
> Thank you!
>
>
>
> **********************
> RESULTS
> **********************
>
>
> fGarch----------------------
>> summary(GA3)
>
> Title:
> GARCH Modelling
>
> Call:
> garchFit(formula = ~arma(1, 0) + aparch(1, 1), data = SPX.log.ret,
> cond.dist = "sstd")
>
> Mean and Variance Equation:
> data ~ arma(1, 0) + aparch(1, 1)
> <environment: 0x000000000c09f038>
> [data = SPX.log.ret]
>
> Conditional Distribution:
> sstd
>
> Coefficient(s):
> mu ar1 omega alpha1 gamma1 beta1
> 0.00025599 -0.06942414 0.00011829 0.08504516 0.99999999 0.91557956
> delta skew shape
> 1.11700143 0.86337982 5.35586013
>
> Std. Errors:
> based on Hessian
>
> Error Analysis:
> Estimate Std. Error t value Pr(>|t|)
> mu 2.560e-04 2.023e-04 1.266 0.205659
> ar1 -6.942e-02 2.332e-02 -2.977 0.002907 **
> omega 1.183e-04 3.481e-05 3.399 0.000677 ***
> alpha1 8.505e-02 1.285e-02 6.616 3.69e-11 ***
> gamma1 1.000e+00 1.441e-02 69.414< 2e-16 ***
> beta1 9.156e-01 1.006e-02 91.041< 2e-16 ***
> delta 1.117e+00 1.962e-01 5.693 1.25e-08 ***
> skew 8.634e-01 2.755e-02 31.337< 2e-16 ***
> shape 5.356e+00 8.347e-01 6.416 1.40e-10 ***
> ---
> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> Log Likelihood:
> 5271.315 normalized: 3.1433
>
> Description:
> Tue Jun 12 09:02:05 2012 by user: cora
>
>
> Standardised Residuals Tests:
> Statistic p-Value
> Jarque-Bera Test R Chi^2 2459.58 0
> Shapiro-Wilk Test R W 0.9528365 0
> Ljung-Box Test R Q(10) 11.72432 0.3039307
> Ljung-Box Test R Q(15) 15.45374 0.4192542
> Ljung-Box Test R Q(20) 21.50983 0.3676896
> Ljung-Box Test R^2 Q(10) 90.12559 5.107026e-15
> Ljung-Box Test R^2 Q(15) 91.15075 6.047385e-13
> Ljung-Box Test R^2 Q(20) 91.74618 3.664247e-11
> LM Arch Test R TR^2 26.18211 0.01011463
>
> Information Criterion Statistics:
> AIC BIC SIC HQIC
> -6.275867 -6.246754 -6.275924 -6.265082
>
> ******************************+
> ******************************
>
>
> rugarch--------------------
>> show(GAA3)
>
> *---------------------------------*
> * GARCH Model Fit *
> *---------------------------------*
>
> Conditional Variance Dynamics
> -----------------------------------
> GARCH Model : apARCH(1,1)
> Mean Model : ARFIMA(1,0,0)
> Distribution : sstd
>
> Optimal Parameters
> ------------------------------------
> Estimate Std. Error t value Pr(>|t|)
> mu 0.000237 0.000190 1.2474e+00 0.212265
> ar1 -0.069601 0.024100 -2.8881e+00 0.003876
> omega 0.000175 0.000148 1.1823e+00 0.237092
> alpha1 0.084114 0.011113 7.5687e+00 0.000000
> beta1 0.920963 0.009835 9.3640e+01 0.000000
> gamma1 1.000000 0.000000 2.6926e+06 0.000000
> delta 1.025983 0.159330 6.4393e+00 0.000000
> skew 0.860581 0.027580 3.1203e+01 0.000000
> shape 5.561683 0.875725 6.3509e+00 0.000000
>
> Robust Standard Errors:
> Estimate Std. Error t value Pr(>|t|)
> mu 0.000237 NaN NaN NaN
> ar1 -0.069601 NaN NaN NaN
> omega 0.000175 NaN NaN NaN
> alpha1 0.084114 NaN NaN NaN
> beta1 0.920963 NaN NaN NaN
> gamma1 1.000000 NaN NaN NaN
> delta 1.025983 NaN NaN NaN
> skew 0.860581 NaN NaN NaN
> shape 5.561683 NaN NaN NaN
>
> LogLikelihood : 5291.85
>
> Information Criteria
> ------------------------------------
>
> Akaike -6.3004
> Bayes -6.2712
> Shibata -6.3004
> Hannan-Quinn -6.2896
>
> Q-Statistics on Standardized Residuals
> ------------------------------------
> statistic p-value
> Lag10 8.594 0.4756
> Lag15 13.965 0.4523
> Lag20 20.967 0.3386
>
> H0 : No serial correlation
>
> Q-Statistics on Standardized Squared Residuals
> ------------------------------------
> statistic p-value
> Lag10 28.13 0.0009072
> Lag15 31.84 0.0042245
> Lag20 35.40 0.0124798
>
> ARCH LM Tests
> ------------------------------------
> Statistic DoF P-Value
> ARCH Lag[2] 12.84 2 0.001630
> ARCH Lag[5] 14.26 5 0.014050
> ARCH Lag[10] 28.19 10 0.001683
>
> Nyblom stability test
> ------------------------------------
> Joint Statistic: NA
> Individual Statistics:
> mu 0.90793
> ar1 0.11145
> omega 0.91076
> alpha1 0.53714
> beta1 0.60241
> gamma1 NA
> delta 0.84958
> skew 0.06079
> shape 0.50963
>
> Asymptotic Critical Values (10% 5% 1%)
> Joint Statistic: 2.1 2.32 2.82
> Individual Statistic: 0.35 0.47 0.75
>
> Sign Bias Test
> ------------------------------------
> t-value prob sig
> Sign Bias 0.7081 0.478964
> Negative Sign Bias 2.7958 0.005236 ***
> Positive Sign Bias 2.7352 0.006301 ***
> Joint Effect 15.8663 0.001208 ***
>
>
> Adjusted Pearson Goodness-of-Fit Test:
> ------------------------------------
> group statistic p-value(g-1)
> 1 20 53.65 3.733e-05
> 2 30 62.55 2.942e-04
> 3 40 67.52 3.081e-03
> 4 50 86.60 7.431e-04
>
>
> Elapsed time : 4.712
>
> --
> View this message in context: http://r.789695.n4.nabble.com/rugarch-and-fGarch-tp4633077.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.
More information about the R-SIG-Finance
mailing list