[R-SIG-Finance] Estimating the T-S Garch model

John Frain frainj at tcd.ie
Fri May 2 12:01:13 CEST 2008


Thanks.  The TS-Garch is now working as expected.

I had updated all the packages in the order specified except
fUnitroots.  When I load fGarch I get a warning message (output below)
which not be important (it is only a warning message).  The downloaded
fUnitroots.zip is only  9KB.  I have tried several times  but can not
download the full file.If I try

install.packages("fUnitRoots",repos="http://R-Forge.R-project.org")

I get a warning message

package  fUnitRoots is not available.

Best Regards

John

> library(fGarch)
Loading required package: fBasics
Loading required package: MASS
Loading required package: fImport
Loading required package: fSeries
Loading required package: robustbase
Loading required package: fCalendar
Loading required package: fEcofin
Loading required package: fUtilities
Rmetrics Package fUtilities (270.73) loaded.
Rmetrics Package fEcofin (270.73) loaded.
Rmetrics Package fCalendar (270.74) loaded.
Rmetrics Package fSeries (270.73) loaded.
Rmetrics Package fImport (270.73) loaded.
Rmetrics Package fBasics (270.73) loaded.
Loading required package: fArma
Rmetrics Package fArma (270.73) loaded.
Rmetrics Package fGarch (270.73) loaded.
Warning message:
In .recacheSubclasses(def at className, def, doSubclasses) :
  Undefined subclass, "double", of class "index_timeSeries";
definition not updated


2008/5/1 michal miklovic <mmiklovic at yahoo.com>:
>
> Hi,
>
> it is a bug and it has already been solved in the development version of
> fGarch. Rmetrics development web is at:
> http://r-forge.r-project.org/projects/rmetrics
> where you can find the latest versions of all packages. Download the zipped
> Windows binaries and install them in the following order:
> fUtilities, fEcofin, fCalendar, fSeries, fImport, fBasics, fBonds, fArma,
> fGarch, fTrading, fExtremes, fNonlinear, fOptions, fAsianOptions,
> fExoticOptions, fUnitRoots, fMultivar, fCopulae, fRegression, fAssets,
> fPortfolio, Rmetrics
> and the estimation should work fine.
>
> Best regards,
>
> Michal
>
>
>
>
> ----- Original Message ----
> From: John Frain <frainj at tcd.ie>
> To: R-SIG-Finance mailing list <r-sig-finance at stat.math.ethz.ch>
> Sent: Thursday, May 1, 2008 11:23:47 PM
> Subject: [R-SIG-Finance] Estimating the T-S Garch model
>
>  I am trying to estimate a T-S Garch model with the following code -
>
> library(fGarch)
> myFinCenter =  "GMT"
> dframe=read.csv(file="loss.csv")
> dframe[1:5,]
> loss=as.timeSeries(dframe)
> head(loss)
> tail(loss)
> fit = garchFit(formula = ~ aparch(1,1), data=loss at Data, delta=1.0,
> include.delta=FALSE,trace=FALSE)
> summary(fit)
> fit2 = garchFit(formula = ~ aparch(1,1), data=loss at Data, delta=1.0,
> include.delta=FALSE,leverage=FALSE)
>
> Output is at the end of the email.  I can estimate a model with
> nonzero leverage (gamma1 non-zero) but I have problems when I try to
> force gamma1 to be zero.  (See message at end of output.  Is there a
> problem or have I not understood something.
> I am using Windows XP,  R 2.7.0 and fGarch 260.72.  The data-set
> loss.csv is attached.
>
>
> --
> John C Frain
> Trinity College Dublin
> Dublin 2
> Ireland
> www.tcd.ie/Economics/staff/frainj/home.htm
> mailto:frainj at tcd.ie
> mailto:frainj at gmail.com
>
>
> ############## OUTPUT ##############################
>
> > library(fGarch)
> > myFinCenter =  "GMT"
> > dframe=read.csv(file="loss.csv")
> > dframe[1:5,]
>           X      loss
> 1 1988-01-05 -3.2854337
> 2 1988-01-06 -2.6706190
> 3 1988-01-07  0.3662351
> 4 1988-01-08 -1.8030495
> 5 1988-01-11  1.1893279
> > loss=as.timeSeries(dframe)
> > head(loss)
>                 TS.1
> 1988-01-05 -3.2854337
> 1988-01-06 -2.6706190
> 1988-01-07  0.3662351
> 1988-01-08 -1.8030495
> 1988-01-11  1.1893279
> 1988-01-12 -0.1981119
> > tail(loss)
>                 TS.1
> 2008-01-24 -4.8668943
> 2008-01-25  0.7808780
> 2008-01-28  1.7767990
> 2008-01-29 -1.1739951
> 2008-01-30 -0.5321964
> 2008-01-31  1.3622478
> > fit = garchFit(formula = ~ aparch(1,1), data=loss at Data, delta=1.0,
> include.delta=FALSE,trace=FALSE)
> > summary(fit)
>
> Title:
>  GARCH Modelling
>
> Call:
>  garchFit(formula = ~aparch(1, 1), data = loss at Data, delta = 1,
>     include.delta = FALSE, trace = FALSE)
>
> Mean and Variance Equation:
>  ~arma(0, 0) + ~aparch(1, 1)
>
> Conditional Distribution:
>  dnorm
>
> Coefficient(s):
>         mu      omega      alpha1      gamma1      beta1
> -0.0624601  0.0274496  0.0816745  -0.3396468  0.9100114
>
> Error Analysis:
>         Estimate  Std. Error  t value Pr(>|t|)
> mu    -0.062460    0.011934  -5.234 1.66e-07 ***
> omega  0.027450    0.005269    5.210 1.89e-07 ***
> alpha1  0.081675    0.009555    8.548  < 2e-16 ***
> gamma1 -0.339647    0.047851  -7.098 1.27e-12 ***
> beta1  0.910011    0.011797  77.139  < 2e-16 ***
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> Log Likelihood:
>  6630.546    normalized:  1.316368
>
> Standadized Residuals Tests:
>                                 Statistic p-Value
>  Jarque-Bera Test  R    Chi^2  5720.432  0
>  Shapiro-Wilk Test  R    W      NA        NA
>  Ljung-Box Test    R    Q(10)  102.3393  0
>  Ljung-Box Test    R    Q(15)  108.0036  4.440892e-16
>  Ljung-Box Test    R    Q(20)  118.3874  5.551115e-16
>  Ljung-Box Test    R^2  Q(10)  80.30754  4.369838e-13
>  Ljung-Box Test    R^2  Q(15)  86.34728  4.738099e-12
>  Ljung-Box Test    R^2  Q(20)  88.63123  1.28495e-10
>  LM Arch Test      R    TR^2  66.55288  1.405827e-09
>
> Information Criterion Statistics:
>       AIC      BIC      SIC      HQIC
> -2.630751 -2.624274 -2.630753 -2.628482
>
> Description:
>  Thu May 01 20:58:17 2008 by user: John C Frain
>
> > fit = garchFit(formula = ~ aparch(1,1), data=loss at Data, delta=1.0,
> include.delta=FALSE,leverage=FALSE)
>
> Series Initialization:
>  ARMA model:                arma
>  Formula mean:              ~ arma(0, 0)
>  GARCH model:              aparch
>  Formula var:              ~ aparch(1, 1)
>  ARMA Order:                0 0
>  Max ARMA Order:            0
>  GARCH Order:              1 1
>  Max GARCH Order:          1
>  Maximum Order:            1
>  h.start:                  2
>  llh.start:                1
>  Length of Series:          5037
>  Recursion Init:            mci
>  Series Scale:              1.000351
>
> Parameter Initialization:
>  Initial Parameters:          $params
>  Limits of Transformations:  $U, $V
>  Which Parameters are Fixed?  $includes
>  Parameter Matrix:
>                       U          V      params includes
>     mu    -4.830854e-01  0.4830854 -0.04830854    TRUE
>     omega  1.000703e-06 100.0703024  0.10007030    TRUE
>     alpha1  1.000000e-08  1.0000000  0.10000000    TRUE
>     gamma1 -1.000000e+00  1.0000000  0.10000000    FALSE
>     beta1  1.000000e-08  1.0000000  0.80000000    TRUE
>     delta  0.000000e+00  2.0000000  1.00000000    FALSE
>     skew    1.000000e-01  10.0000000  1.00000000    FALSE
>     shape  1.000000e+00  20.0000000  4.00000000    FALSE
>  Index List of Parameters to be Optimized:
>     mu  omega alpha1  beta1
>     1      2      3      5
>  Persistence:                  0.8797885
>
> Iteration Path:
>
>
>
> Now NLMINB
>
>
> Error in gamma[i] : object is not subsettable
> >
>
>
>  ________________________________
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
> now.



-- 
John C Frain
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.htm
mailto:frainj at tcd.ie
mailto:frainj at gmail.com



More information about the R-SIG-Finance mailing list