[R] fSeries - Ox - ver: 240.10068 - Steps to make it work

From: Ian Gregory <ian_at_iangregory.com>
Date: Sat, 16 Jun 2007 11:57:10 +1000

-Bugs and fixes reported to Diethelm Wuertz.
-In the interim. To make the Ox functions part of the fSeries package work please follow the following steps.


  1. Install R-project.
  2. Install fSeries.
  3. Download: http://www.core.ucl.ac.be/~laurent/G@RCH/site/xbdcons/garch42.zip (G@RCH package for Ox)
  4. Download: http://www.doornik.com/download/b736gw/oxcons.html (Ox console)
  5. Install Ox console to directory "c:\ox"
  6. Copy: R-2.5.0\library\fSeries\ox\GarchOxModelling.ox c:\ox\ox\lib\GarchOxModelling.ox
  7. Load R-Project
  8. Run: library(fSeries) data(dem2gbp) x = dem2gbp[, 1] garchOxFit(~garch(1,1),x)
    Causes the errors: Error in paste(OXPATH, "\\bin\\oxl.exe ", OXPATH, "\\lib\\GarchOxModelling.ox", : object "OXPATH" not found

This can be fixed by setting the directory in R-Project to where Ox is installed. ie. OXPATH="c:\ox\ox". 9. garchOxFit(~garch(1,1),x)

  1. Copy the G_at_RCH package files to "c:\ox\ox\packages\Garch42"
  2. Change the line in GarchOxModelling.ox: #import <packages/Garch40/garch> to #import <packages/Garch42/garch>

13.
garchOxFit(~garch(1,1),x)

Will give the following error:



Ox version 4.1 (Windows) (C) J.A. Doornik, 1994-2006 This version may be used for academic research and teaching only Copyright for this package: S. Laurent and J.P. Peters, 2000-2006. G_at_RCH package version 4.2, object created on 7-06-2007

Starting Values
Parameter      Starting Value
Cst(M)               0.010000
Cst(V)               0.050000
ARCH(Alpha1)         0.100000
GARCH(Beta1)         0.800000

-------------------------------------

Bounds
Parameter         Lower Bound Upper Bound
Cst(M)            -100.000000  100.000000
Cst(V)               0.000000  100.000000
ARCH(Alpha1)         0.000000    1.000000
GARCH(Beta1)         0.000000    1.000000
Runtime error: 'DoEstimation' wrong number of arguments Runtime error occurred in main(207), call trace: c:/ox/Ox\lib\GarchOxModelling.ox (207): main Error in file(file, "r") : unable to open connection In addition: Warning message:
cannot open file 'OxResiduals.csv', reason 'No such file or directory'
  1. This can be fixed by changing the line in GarchOxModelling.ox: from garchobj.DoEstimation(); to garchobj.DoEstimation(<>);

15.
Running:
garchOxFit(~garch(1,1),x)

Will give a 'typo' error is at the end of the estimation. Which needs to be fixed by the developer as it is compiled code.
However, now the function works and can call Ox from R-Prooject to estimate models.




[1] "garch(1, 1)"

Ox version 4.1 (Windows) (C) J.A. Doornik, 1994-2006 This version may be used for academic research and teaching only Copyright for this package: S. Laurent and J.P. Peters, 2000-2006. G_at_RCH package version 4.2, object created on 11-06-2007



Starting Values
Parameter      Starting Value
Cst(M)               0.010000
Cst(V)               0.050000
ARCH(Alpha1)         0.100000
GARCH(Beta1)         0.800000

-------------------------------------

Bounds
Parameter         Lower Bound Upper Bound
Cst(M)            -100.000000  100.000000
Cst(V)               0.000000  100.000000
ARCH(Alpha1)         0.000000    1.000000
GARCH(Beta1)         0.000000    1.000000

Starting values
parameters

     0.010000     0.050000      0.10000      0.80000
Initial function =      -1312.86321151

Position after 5 SQPF iterations
parameters

    0.0054353     0.038781      0.20486      0.60034
function value =      -1125.76603281  steplen = 0.03125

Position after 10 SQPF iterations
parameters

   -0.0088801     0.012371      0.17148      0.78507
function value =      -1106.89461928

Position after 14 SQPF iterations
Status: Strong convergence
parameters

   -0.0061830     0.010761      0.15341      0.80588
function value =      -1106.58656395

Ian - Doing output

Strong convergence using numerical derivatives Log-likelihood = -1106.59
Please wait : Computing the Std Errors ...

 Maximum Likelihood Estimation (Std.Errors based on Second derivatives)

                  Coefficient  Std.Error  t-value  t-prob
Cst(M)              -0.006183  0.0084616  -0.7307  0.4650
Cst(V)               0.010761  0.0028506    3.775  0.0002
ARCH(Alpha1)         0.153406   0.026568    5.774  0.0000
GARCH(Beta1)         0.805877   0.033542    24.03  0.0000

No. Observations :      1974  No. Parameters  :         4
Mean (Y)         :  -0.01643  Variance (Y)    :   0.22102
Skewness (Y)     :  -0.24951  Kurtosis (Y)    :   6.62765
Log Likelihood : -1106.587 Alpha[1]+Beta[1]: 0.95908

The sample mean of squared residuals was used to start recursion. The positivity constraint for the GARCH (1,1) is observed. This constraint is alpha[L]/[1 - beta(L)] >= 0. The unconditional variance is 0.262984
The conditions are alpha[0] > 0, alpha[L] + beta[L] < 1 and alpha[i] + beta[i] >= 0.   => See Doornik & Ooms (2001) for more details. The condition for existence of the fourth moment of the GARCH is observed. The constraint equals 0.966907 and should be < 1.   => See Ling & McAleer (2001) for details.

Estimated Parameters Vector :
-0.006183; 0.010761; 0.153406; 0.805877


Horizon       Mean   Variance
      1  -0.006183      0.147
      2  -0.006183     0.1517
      3  -0.006183     0.1563
      4  -0.006183     0.1606
      5  -0.006183     0.1648
      6  -0.006183     0.1688
      7  -0.006183     0.1727
      8  -0.006183     0.1764
      9  -0.006183     0.1799
     10  -0.006183     0.1833
     11  -0.006183     0.1866
     12  -0.006183     0.1897
     13  -0.006183     0.1927
     14  -0.006183     0.1956
     15  -0.006183     0.1983


Forecasts errors measures cannot be computed because there are not enough out-of-sample observations). Elapsed Time : 0.219 seconds (or 0.00365 minutes).

Residual-Based Diagnostic for Conditional Heteroskedasticity of Tse (2001)

  RBD(10) =  8.28059   [0.6014503]
  RBD(15) =  14.9050   [0.4582834]
  RBD(20) =  15.6049   [0.7408121]

------------------------------------------------
P-values in brackets

Diagnostic test based on the news impact curve (EGARCH vs. GARCH)

                                     Test  P-value
Sign Bias t-Test                  1.31906  0.18715
Negative Size Bias t-Test         0.24103  0.80953
Positive Size Bias t-Test         0.66341  0.50707
Joint Test for the Three Effects 2.87881 0.41069

Joint Statistic of the Nyblom test of stability: 0.664173

Individual Nyblom Statistics:

Cst(M)           0.16731
Cst(V)           0.35503
ARCH(Alpha1)     0.26363
GARCH(Beta1)     0.33496

Rem: Asymptotic 1% critical value for individual statistics = 0.75.
     Asymptotic 5% critical value for individual statistics = 0.47.

Adjusted Pearson Chi-square Goodness-of-fit test

# Cells(g)  Statistic      P-Value(g-1)     P-Value(g-k-1)   
    40      137.4083         0.000000          0.000000
    50      160.5491         0.000000          0.000000
    60      166.5471         0.000000          0.000000
Rem.: k = 4 = # estimated parameters

Error in .garchOxFit(formula.mean, formula.var, series = x, cond.dist, :  could not find function ".descrption"

        [[alternative HTML version deleted]]



R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 16 Jun 2007 - 02:02:43 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 16 Jun 2007 - 11:31:57 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.