FIGARCH in R (rugarch)¶
The package cross-check for long memory (companion to figarch_python.ipynb)¶
The from-scratch notebook estimated a fractional integration parameter $d=0.52$ on the S&P 500 — genuine long memory, well inside $(0,1)$. Here we confirm it with rugarch (Ghalanos), the standard R volatility library, whose fiGARCH variance model implements the same Baillie–Bollerslev–Mikkelsen (1996) specification with an independently-coded optimiser. If $d$ lands near $0.52$ again, the long-memory finding is not an artifact of our hand-written filter.
Data: daily S&P 500 log returns, sp500ret.csv (1987–2009) — the same series figarch_python.ipynb and the MS-GARCH rival use.
In [1]:
.libPaths('C:/Users/user/R/win-library/4.6')
suppressMessages(library(rugarch))
d <- read.csv('sp500ret.csv'); r <- d$ret; dates <- as.Date(d$date) # S&P 500 daily returns, 1987-2009
# FIGARCH(1,d,1) with Student-t innovations, zero mean (returns are already de-meaned in the arc)
spec <- ugarchspec(variance.model = list(model = 'fiGARCH', garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(0, 0), include.mean = FALSE),
distribution.model = 'std')
fit <- ugarchfit(spec, data = r, solver = 'hybrid')
cf <- coef(fit)
aic <- -2 * likelihood(fit) + 2 * length(cf) # total-scale AIC (matches from-scratch)
cat('FIGARCH-t via rugarch on S&P 500 daily returns 1987-2009:\n')
cat(sprintf(' omega %.3f d (delta) %.3f alpha(phi) %.3f beta %.3f nu (shape) %.2f\n',
cf['omega'], cf['delta'], cf['alpha1'], cf['beta1'], cf['shape']))
cat(sprintf(' AIC %.0f (rugarch reports persistence = NA: FIGARCH shock effect is infinitely persistent)\n', aic))
cat('\ncross-check -> from-scratch FIGARCH-t: d 0.523, phi 0.175, beta 0.667, nu 6.23, AIC 14677 (agree)\n')
cat(sprintf(' d = %.3f in (0,1): genuine LONG MEMORY confirmed by an independent optimiser.\n', cf['delta']))
FIGARCH-t via rugarch on S&P 500 daily returns 1987-2009:
omega 0.021 d (delta) 0.525 alpha(phi) 0.179 beta 0.671 nu (shape) 6.28
AIC 14696 (rugarch reports persistence = NA: FIGARCH shock effect is infinitely persistent)
cross-check -> from-scratch FIGARCH-t: d 0.523, phi 0.175, beta 0.667, nu 6.23, AIC 14677 (agree)
d = 0.525 in (0,1): genuine LONG MEMORY confirmed by an independent optimiser.
The long-memory conditional volatility¶
In [2]:
options(repr.plot.width = 11, repr.plot.height = 4.3)
vol <- as.numeric(sigma(fit)) * sqrt(252) # annualized conditional volatility (%)
plot(dates, vol, type = 'l', col = 'firebrick', lwd = .5, xlab = '',
ylab = 'annualized conditional vol (%)',
main = 'FIGARCH-t (rugarch): conditional volatility, S&P 500 daily 1987-2009')
abline(h = sqrt(252) * sd(r), col = 'grey55', lty = 2)
legend('topleft', c('FIGARCH conditional vol', 'unconditional vol'),
col = c('firebrick', 'grey55'), lwd = c(1.4, 1), lty = c(1, 2), bty = 'n', cex = .85)
Results¶
rugarchreproduces the long memory. The fractional parameter $d$ (rugarch'sdelta) comes back near the from-scratch 0.52, again strictly inside $(0,1)$ — neither short-memory GARCH ($d=0$) nor integrated IGARCH ($d=1$). An independent, professionally-optimised implementation confirms the headline result: S&P 500 volatility has genuine long memory.- The volatility path shows the slow decay. After each shock the FIGARCH conditional volatility eases back toward its unconditional level only gradually (hyperbolic decay $\sim j^{\,d-1}$), rather than snapping back geometrically — the long, slowly-fading memory the from-scratch weight plot quantified (~7% of a shock still felt after 100 days).
- This completes the persistence pair's validation. Both rivals now carry a package cross-check — FIGARCH via
rugarch(long memory, $d=0.52$) and MS-GARCH viaMSGARCH(sustained regimes) — and both from-scratch engines are confirmed. The verdict stands: the near-unit-root persistence is genuine long memory, with a slow business-cycle regime layer on top.
References¶
- Ghalanos, A.
rugarch: Univariate GARCH models (R package). - Baillie, R. T., Bollerslev, T. & Mikkelsen, H. O. (1996). Fractionally integrated generalized autoregressive conditional heteroskedasticity. J. Econometrics 74, 3–30.