Skip to content
All library documents

Simulating ARMA-GARCH Models and Diagnosing Common Errors

Article Quant Q&A · Author: Tom

Summary

The document compares several attempts to simulate an ARMA-GARCH process in R, using fitted ARMA and GARCH parameters. It describes trying a specification with a simulation function, a separate ARMA-GARCH simulator, a GARCH simulator combined with ARIMA simulation, and bootstrap forecasts from an ARIMA model. The reported outcomes include a NaN result, a simulator output that appears to contain model metadata rather than a time series, and errors about finite variance and AR stationarity.

The examples illustrate that simulation depends on matching the model specification and parameterization expected by each package, and that stationarity and finite-variance conditions need attention. However, the document is a troubleshooting question rather than a resolved tutorial: it does not establish which method works or provide a validated ARMA-GARCH forecast procedure. The displayed code also contains apparent syntax issues, so its snippets should not be treated as ready-to-run implementations.

Key ideas

  • ARMA-GARCH simulation requires a simulator that supports the combined mean and conditional-variance specification.
  • A GARCH parameter set can fail simulation if its variance conditions are not satisfied.
  • AR stationarity is a separate condition from fitting or forecasting an ARMA-GARCH model.
  • Bootstrap forecasts from an ARIMA model do not automatically incorporate a GARCH volatility component.

Tags

Full text
# Forecast of ARMA-GARCH model in R


# Forecast of ARMA-GARCH model in R












I managed to forecast a GARCH model yesterday and run a Monte Carlo simulation on R. Nevertheless, I can't do the same with an ARMA-GARCH. I tested 4 different method but without achieving an ARMA-GARCH simulation with my data.

The packages and the data I used:

```
library(quantmod)
library(tseries)
library(TSA)
library(betategarch)
library(mcsm)
library(PerformanceAnalytics)
library(forecast)
library(fGarch)
library(GEVStableGarch)

getSymbols("DEXB.BR",from="2005-07-01", to="2015-07-01")
STOCK = DEXB.BR
STOCK.rtn=diff(STOCK[,6] )
STOCK.diff = STOCK.rtn[2:length(STOCK.rtn)]
ARI_2_1=arima(STOCK[,6],order=c(2,1,1))
GA_1_1=garch(ARI_2_1$residuals, order = c(1,1))
```

## First tested method

```
specifi = garchSpec(model = list(ar = c(0.49840, -0.0628), ma =c(-0.4551), omega = 8.393e-08, alpha = 1.356e-01, beta = 8.844e-01))

garchSim(spec = specifi, n = 500, n.start = 200, extended = FALSE)
```

This lead to a "NaN" forecast.

garchSim(spec = specifi, n = 500)

n=1000 armagarch.sim_1 = rep(0,n) armagarch.sim_50 = rep(0,n) armagarch.sim_100 = rep(0,n) for(i in 1:n) { armagarch.sim=garchSim(spec = specifi, n = 500, n.start = 200, extended = FALSE) armagarch.sim_1[i] = armagarch.sim[1] armagarch.sim_50[i] = armagarch.sim[50] armagarch.sim_100[i] = armagarch.sim[100]

}

## Second tested method

GSgarch.Sim(N = 500, mu = 0, a = c(0.49840, -0.0628), b = c(-0.4551), omega = 8.393e-08, alpha = c(1.356e-01), gm = c(0), beta = c(8.844e-01), cond.dist = "norm")

This part works.

```
n=10000

Garmagarch.sim_1 = rep(0,n)
Garmagarch.sim_50 = rep(0,n)
Garmagarch.sim_100 = rep(0,n)

for(i in 1:n)
{
    Garmagarch.sim= GSgarch.Sim(N = 500, mu = 0, a = c(0.49840, -0.0628), b = c(-0.4551),omega = 8.393e-08, alpha = c(1.356e-01), gm = c(0), beta c(8.844e-01), cond.dist = "norm")

    Garmagarch.sim_1[i] = Garmagarch.sim[1]
    Garmagarch.sim_50[i] = Garmagarch.sim[50]
    Garmagarch.sim_100[i] = Garmagarch.sim[100]

}
```

The simulation runs but

```
> Garmagarch.sim[1]
$model
[1] "arma(2,1)-aparch(1,1) ## Intercept:FALSE"
```

and

```
> Garmagarch.sim[50]
$<NA>
NULL
```

## Third tested method

```
ga_arma = garch.sim(alpha=c(8.393e-08,1.356e-01),beta =8.844e-01 ,n=500, ntrans=200)
```

This lead to

```
Error in garch.sim(alpha = c(8.393e-08, 0.1356), beta = 0.8844, n = 500,  : 
  Check model: it does not have finite variance

arima.sim(ARI_2_1, 500, innov = ga_arma ,n.start = 200)
```

And this to

```
Error in arima.sim(ARI_2_1, 500, innov = ga_arma, n.start = 200) : 
  la partie 'ar' du mopdèle n'est pas stationaire
```

which mean that the 'ar' part of the model isn't stationnary.

## Fourth tested method

```
forecast(ARI_2_1, h = 500, bootstrap = TRUE, npaths=200)
```

This one actually works but I don't know how to add the GARCH component.

```
forecast(specifi, h = 500, bootstrap = TRUE, npaths=200)
```

Thanks !

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.