|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
Estimating the T-S Garch modelI 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@Data, delta=1.0, include.delta=FALSE,trace=FALSE) summary(fit) fit2 = garchFit(formula = ~ aparch(1,1), data=loss@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@... mailto:frainj@... ############## 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@Data, delta=1.0, include.delta=FALSE,trace=FALSE) > summary(fit) Title: GARCH Modelling Call: garchFit(formula = ~aparch(1, 1), data = loss@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@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 > _______________________________________________ R-SIG-Finance@... mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first. |
|
|
|
|
|
Re: Estimating the T-S Garch modelThanks. 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@className, def, doSubclasses) : Undefined subclass, "double", of class "index_timeSeries"; definition not updated 2008/5/1 michal miklovic <mmiklovic@...>: > > 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@...> > To: R-SIG-Finance mailing list <r-sig-finance@...> > 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@Data, delta=1.0, > include.delta=FALSE,trace=FALSE) > summary(fit) > fit2 = garchFit(formula = ~ aparch(1,1), data=loss@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@... > mailto:frainj@... > > > ############## 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@Data, delta=1.0, > include.delta=FALSE,trace=FALSE) > > summary(fit) > > Title: > GARCH Modelling > > Call: > garchFit(formula = ~aparch(1, 1), data = loss@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@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@... mailto:frainj@... _______________________________________________ R-SIG-Finance@... mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first. |
|
|
Re: Estimating the T-S Garch model>>>> "MM" == michal miklovic <mmiklovic@...>
>>>> on Thu, 1 May 2008 14:58:29 -0700 (PDT) MM> it is a bug and it has already been solved in the MM> development version of fGarch. Rmetrics development web is MM> at: http://r-forge.r-project.org/projects/rmetrics MM> where you can find the latest versions of all MM> packages. Download the zipped Windows binaries and install MM> them in the following order: MM> fUtilities, fEcofin, fCalendar, fSeries, fImport, fBasics, MM> fBonds, fArma, fGarch, fTrading, fExtremes, fNonlinear, MM> fOptions, fAsianOptions, fExoticOptions, fUnitRoots, MM> fMultivar, fCopulae, fRegression, fAssets, fPortfolio, MM> Rmetrics MM> and the estimation should work fine. Note you can use the script installRmetrics to install "fGarch" development package with source("http://rmetrics.R-Forge.R-project.org/installRmetrics.R") installRmetrics("fGarch", repos="http://R-Forge.R-project.org") Or any other Rmetrics development package... regards, Yohan -- PhD student Swiss Federal Institute of Technology Zurich www.ethz.ch www.rmetrics.org NOTE: Rmetrics Workshop: http://www.rmetrics.org/meielisalp.htm June 29th - July 3rd Meielisalp, Lake Thune, Switzerland _______________________________________________ R-SIG-Finance@... mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first. |
|
|
Re: Estimating the T-S Garch modelThis script does not appear to work for me. I have already loaded
fGarch 270.73 and when I try to run the script followed by the call to the 'iinstall' program i get the error message below. (I have ran the script from the internet and also downloaded it to my PC and the result is the same). |Packages|Update packages| works in the windows GUI. My version of fUnitRoots is 260.72 and it will not update. I had previously tried to download the zipped file for fUnitRoots and failed. I tried again this evening and failed again. (I have downloaded all the remaining Rmetrics files at this stage). Best regards John R version 2.7.0 (2008-04-22) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > source("H:\\Archives\\software_econometric\\R\\R-2.7.0\\Rmetrics\\installRmetrics.R") > installRmetrics("fGarch", repos="http://R-Forge.R-project.org") Error in FUN("fGarch"[[1L]], ...) : subscript out of bounds > 2008/5/6 Yohan Chalabi <chalabi@...>: > >>>> "MM" == michal miklovic <mmiklovic@...> > >>>> on Thu, 1 May 2008 14:58:29 -0700 (PDT) > > > MM> it is a bug and it has already been solved in the > MM> development version of fGarch. Rmetrics development web is > MM> at: http://r-forge.r-project.org/projects/rmetrics > MM> where you can find the latest versions of all > MM> packages. Download the zipped Windows binaries and install > MM> them in the following order: > MM> fUtilities, fEcofin, fCalendar, fSeries, fImport, fBasics, > MM> fBonds, fArma, fGarch, fTrading, fExtremes, fNonlinear, > MM> fOptions, fAsianOptions, fExoticOptions, fUnitRoots, > MM> fMultivar, fCopulae, fRegression, fAssets, fPortfolio, > MM> Rmetrics > MM> and the estimation should work fine. > > Note you can use the script installRmetrics to install "fGarch" > development package with > > source("http://rmetrics.R-Forge.R-project.org/installRmetrics.R") > installRmetrics("fGarch", repos="http://R-Forge.R-project.org") > > Or any other Rmetrics development package... > > regards, > Yohan > > -- > PhD student > Swiss Federal Institute of Technology > Zurich > > www.ethz.ch > www.rmetrics.org > > NOTE: > Rmetrics Workshop: http://www.rmetrics.org/meielisalp.htm > June 29th - July 3rd Meielisalp, Lake Thune, Switzerland > > -- John C Frain Trinity College Dublin Dublin 2 Ireland www.tcd.ie/Economics/staff/frainj/home.htm mailto:frainj@... mailto:frainj@... _______________________________________________ R-SIG-Finance@... mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first. |
|
|
Re: Estimating the T-S Garch modelJohn Frain wrote:
> This script does not appear to work for me. I have already loaded > fGarch 270.73 and when I try to run the script followed by the call to > the 'iinstall' program i get the error message below. (I have ran the > script from the internet and also downloaded it to my PC and the > result is the same). |Packages|Update packages| works in the windows > GUI. My version of fUnitRoots is 260.72 and it will not update. I > had previously tried to download the zipped file for fUnitRoots and > failed. I tried again this evening and failed again. (I have > downloaded all the remaining Rmetrics files at this stage). >> Yohan wrote: <snip> >> Note you can use the script installRmetrics to install "fGarch" >> development package with >> >> source("http://rmetrics.R-Forge.R-project.org/installRmetrics.R") >> installRmetrics("fGarch", repos="http://R-Forge.R-project.org") >> >> Or any other Rmetrics development package... The likely cause here is that the .ZIP files have failed to build on R-forge for whatever reason. Since John is using Windows, he won't likely be compiling them from source. Perhaps somebody can take a look at the R-forge Windows build logs for these two packages and figure out what the build issue on Windows is. Regards, - Brian _______________________________________________ R-SIG-Finance@... mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first. |
|
|
Re: Estimating the T-S Garch modelNo solution from me, but I think this may have something to do with
the build issue: http://www.nabble.com/R-Forge-SVN-repositories%3A-R-CMD-build-check-error-on-Windows-machines-to16942927.html Jeff On Tue, May 6, 2008 at 4:53 PM, Brian G. Peterson <brian@...> wrote: > John Frain wrote: > > > This script does not appear to work for me. I have already loaded > > fGarch 270.73 and when I try to run the script followed by the call to > > the 'iinstall' program i get the error message below. (I have ran the > > script from the internet and also downloaded it to my PC and the > > result is the same). |Packages|Update packages| works in the windows > > GUI. My version of fUnitRoots is 260.72 and it will not update. I > > had previously tried to download the zipped file for fUnitRoots and > > failed. I tried again this evening and failed again. (I have > > downloaded all the remaining Rmetrics files at this stage). > > > > > > > > > Yohan wrote: > > > > > > <snip> > > > > > > > Note you can use the script installRmetrics to install "fGarch" > > > development package with > > > > > > source("http://rmetrics.R-Forge.R-project.org/installRmetrics.R") > > > installRmetrics("fGarch", repos="http://R-Forge.R-project.org") > > > > > > Or any other Rmetrics development package... > > > > > > > > The likely cause here is that the .ZIP files have failed to build on > R-forge for whatever reason. Since John is using Windows, he won't likely > be compiling them from source. Perhaps somebody can take a look at the > R-forge Windows build logs for these two packages and figure out what the > build issue on Windows is. > > Regards, > > - Brian > > > > _______________________________________________ > R-SIG-Finance@... mailing list > https://stat.ethz.ch/mailman/listinfo/r-sig-finance > -- Subscriber-posting only. > -- If you want to post, subscribe first. > -- There's a way to do it better - find it. Thomas A. Edison _______________________________________________ R-SIG-Finance@... mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first. |
|
|
Re: Estimating the T-S Garch model>>>> "JF" == "John Frain" <frainj@...>
>>>> on Tue, 6 May 2008 22:28:30 +0100 JF> his script does not appear to work for me. I have already JF> loaded JF> fGarch 270.73 and when I try to run the script followed by JF> the call to JF> the 'iinstall' program i get the error message below. (I JF> have ran the JF> script from the internet and also downloaded it to my PC JF> and the JF> result is the same). |Packages|Update packages| works in JF> the windows JF> GUI. My version of fUnitRoots is 260.72 and it will not JF> update. I JF> had previously tried to download the zipped file for JF> fUnitRoots and JF> failed. I tried again this evening and failed again. (I have JF> downloaded all the remaining Rmetrics files at this stage). There is an issue on R-Forge server with Windows binary packages. According to the log files, there is no gfortran compiler and all packages with Fortran source can cannot be build. But you can compile the packages from source as long as you have the required tools installed. in Rterm type: source("http://rmetrics.R-Forge.R-project.org/installRmetrics.R") installRmetrics("fGarch", repos="http://R-Forge.R-project.org", type = "source", suggests = FALSE) Note with 'suggests = FALSE' suggested packages will not be installed. regards, Yohan -- PhD student Swiss Federal Institute of Technology Zurich www.ethz.ch www.rmetrics.org NOTE: Rmetrics Workshop: http://www.rmetrics.org/meielisalp.htm June 29th - July 3rd Meielisalp, Lake Thune, Switzerland _______________________________________________ R-SIG-Finance@... mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first. |
|
|
|
| Free Forum Powered by Nabble | Forum Help |