Troubleshooting the R Interface for FIGARCH and FIEGARCH Models
Summary
The document discusses errors encountered when using an R interface to Ox for fitting GARCH models, including FIGARCH and possibly FIEGARCH specifications. The reported failures include undeclared file input and output functions in an Ox source file and a missing residuals file. One response says the Rmetrics interface is no longer supported and points to a different R package that provides several GARCH specifications.
Another response identifies a likely configuration issue: an Ox standard library include is commented out, and the package import may need to match the installed G@RCH version. It also gives an example workflow using adjusted equity prices, log returns, and a FIGARCH variance specification, then notes that the missing output file should appear once the file I/O issue is fixed. These are version-specific troubleshooting suggestions, not a guarantee that the legacy interface will work in current environments. The document does not establish whether the suggested setup supports every desired model or remains compatible with present software versions.
Key ideas
- Undeclared Ox file functions may result from a missing standard library include.
- The imported G@RCH package path may need to match the installed version.
- A separate R package is suggested as an alternative to the unsupported Rmetrics interface.
- The missing residuals file may be a downstream symptom of the earlier file I/O failure.
Tags
Full text
# garchOxFit in R
# garchOxFit in R
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.
## Answer by Dirk Eddelbuettel (score 2)
https://quant.stackexchange.com/a/8668
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.
## Answer by brian (score 2)
https://quant.stackexchange.com/a/8669
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.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.