Take the 2-minute tour ×
Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. It's 100% free, no registration required.

Could someone please help me with trying to get the Ox interface to work in R. I followed the steps outlined in this paper (http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1752095), but I get the following errors as output:

Ox Console version 6.21 (Windows/U) (C) J.A. Doornik, 1994-2011 This version may be used for academic research and teaching only

C:\Ox\lib\GarchOxModelling.ox (28): 'fopen' undeclared identifier

C:\Ox\lib\GarchOxModelling.ox (29): 'fscan' undeclared identifier

C:\Ox\lib\GarchOxModelling.ox (39): 'fclose' undeclared identifier

C:\Ox\lib\GarchOxModelling.ox (227): 'fprint' undeclared identifier

Error in file(file, "r") : cannot open the connection

In addition: Warning messages:

1: running command 'C:\Ox\bin\oxl.exe C:\Ox\lib\GarchOxModelling.ox' had status 1

2: In file(file, "r") : cannot open file 'OxResiduals.csv': No such file or directory

How would I go about solving the undeclared identifier problem? And then the following 2 additional warnings messages 1. and 2. ?

I am really out of my depth here but really need to use FIGARCH & possibly FIEGARCH in R. Thanks for any help provided.

share|improve this question
    
Thank you very much for your help brian. It's working now. Much appreciated, sir. And thank you for your suggestion Dirk, but as far as I could gather from the rugarch.pdf, rugarch does not offer the FIGARCH or FIEGARCH –  user5878 Aug 7 '13 at 8:50
add comment

2 Answers

The interface from R to Ox is no longer supported by Rmetrics.

You could look into the Rugarch package from CRAN instead. It supports a number of Garch specifications.

share|improve this answer
add comment

fopen,fscan are in stdio.h but it looks like Ox has their own include file. For some reason it's commented out in garchOxModelling.ox, uncomment that line only.

#include <oxstd.h>  
//#include <packages/gnudraw/gnudraw.h>

I remember I had to change this line as well since I used a newer G@rch distro. It was /Garch42/ , I changed it to /Garch6/

#import <packages/Garch6/garch>

Simple R script

#My test input
library(quantmod)
library(FinTS)
getSymbols(c("SPY"), src='yahoo', from="2005-01-01")#dnld data
sp.close<-as.vector(SPY[,"SPY.Adjusted"])
y1=100*diff(log(sp.close))
#call preloaded custom R function
result.sp=garchOxFit(formula.mean = ∼arma(1, 0), formula.var = ∼figarch.bbm(1,1),
                     series = y1, cond.dist = "skewed-t",include.mean = TRUE, 
                     truncation = 100, trace = TRUE, title=NULL,include.var=TRUE)

Some truncated output

Ox Console version 6.21 (Windows/U) (C) J.A. Doornik, 1994-2011
This version may be used for academic research and teaching only
Copyright for this package: S. Laurent, 2000-2009.
G@RCH package version 6.0, object created on  6-08-2013
-------------------------------------
Starting Values
===============
Parameter      Starting Value
Cst(M)               0.010000
AR(1)                0.010000
Cst(V)               0.040000
d-Figarch            0.450000
ARCH(Phi1)           0.100000
GARCH(Beta1)         0.400000
Asymmetry            0.010000
Tail                 6.000000

Edit: For the second part of your question, the missing files (OxResiduals etc.) will show up in your working dir after you fix the file io problem.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.