fit_GARCH_11: Fast(er) and Numerically More Robust Fitting of GARCH(1,1)...

View source: R/fit_ARMA_GARCH.R

fit_GARCH_11R Documentation

Fast(er) and Numerically More Robust Fitting of GARCH(1,1) Processes

Description

Fast(er) and numerically more robust fitting of GARCH(1,1) processes according to Zumbach (2000).

Usage

fit_GARCH_11(x, init = NULL, sig2 = mean(x^2), delta = 1,
             distr = c("norm", "st"), control = list(), ...)
tail_index_GARCH_11(innovations, alpha1, beta1,
                    interval = c(1e-6, 1e2), ...)

Arguments

x

vector of length n containing the data (typically log-returns) to be fitted a GARCH(1,1) to.

init

vector of length 2 giving the initial values for the likelihood fitting. Note that these are initial values for z_{corr} and z_{ema} as in Zumbach (2000).

sig2

annualized variance (third parameter of the reparameterization according to Zumbach (2000)).

delta

unit of time (defaults to 1 meaning daily data; for yearly data, use 250).

distr

character string specifying the innovation distribution ("norm" for N(0,1) or "st" for a standardized t distribution).

control

see ?optim().

innovations

random variates from the innovation distribution; for example, obtained via rnorm() or rt(, df = nu) * sqrt((nu-2)/nu) where nu are the d.o.f. of the t distribution.

alpha1

nonnegative GARCH(1,1) coefficient alpha[1] satisfying alpha[1] + beta[1] < 1.

beta1

nonnegative GARCH(1,1) coefficient beta[1] satisfying alpha[1] + beta[1] < 1.

interval

initial interval for computing the tail index; passed to the underlying uniroot().

...
fit_GARCH_11():

additional arguments passed to the underlying optim().

tail_index_GARCH_11():

additional arguments passed to the underlying uniroot().

Value

fit_GARCH_11():
coef:

estimated coefficients \alpha_0, \alpha_1, \beta_1 and, if distr = "st" the estimated degrees of freedom.

logLik:

maximized log-likelihood.

counts:

number of calls to the objective function; see ?optim.

convergence:

convergence code ('0' indicates successful completion); see ?optim.

message:

see ?optim.

sig.t:

vector of length n giving the conditional volatility.

Z.t:

vector of length n giving the standardized residuals.

tail_index_GARCH_11():

The tail index alpha estimated by Monte Carlo via McNeil et al. (2015, p. 576), so the alpha which solves

E({(\alpha_1Z^2 + \beta_1)}^{\alpha/2}) = 1

, where Z are the innovations. If no solution is found (e.g. if the objective function does not have different sign at the endpoints of interval), NA is returned.

Author(s)

Marius Hofert

References

Zumbach, G. (2000). The pitfalls in fitting GARCH (1,1) processes. Advances in Quantitative Asset Management 1, 179–200.

McNeil, A. J., Frey, R. and Embrechts, P. (2015). Quantitative Risk Management: Concepts, Techniques, Tools. Princeton University Press.

See Also

fit_ARMA_GARCH() based on rugarch.

Examples

### Example 1: N(0,1) innovations ##############################################

## Generate data from a GARCH(1,1) with N(0,1) innovations
library(rugarch)
uspec <- ugarchspec(variance.model = list(model = "sGARCH",
                                          garchOrder = c(1, 1)),
                    distribution.model = "norm",
                    mean.model = list(armaOrder = c(0, 0)),
                    fixed.pars = list(mu = 0,
                                      omega = 0.1, # alpha_0
                                      alpha1 = 0.2, # alpha_1
                                      beta1 = 0.3)) # beta_1
X <- ugarchpath(uspec, n.sim = 1e4, rseed = 271) # sample (set.seed() fails!)
X.t <- as.numeric(X@path$seriesSim) # actual path (X_t)

## Fitting via ugarchfit()
uspec. <- ugarchspec(variance.model = list(model = "sGARCH",
                                           garchOrder = c(1, 1)),
                     distribution.model = "norm",
                     mean.model = list(armaOrder = c(0, 0)))
fit <- ugarchfit(uspec., data = X.t)
coef(fit) # fitted mu, alpha_0, alpha_1, beta_1
Z <- fit@fit$z # standardized residuals
stopifnot(all.equal(mean(Z), 0, tol = 1e-2),
          all.equal(var(Z),  1, tol = 1e-3))

## Fitting via fit_GARCH_11()
fit. <- fit_GARCH_11(X.t)
fit.$coef # fitted alpha_0, alpha_1, beta_1
Z. <- fit.$Z.t # standardized residuals
stopifnot(all.equal(mean(Z.), 0, tol = 5e-3),
          all.equal(var(Z.),  1, tol = 1e-3))

## Compare
stopifnot(all.equal(fit.$coef, coef(fit)[c("omega", "alpha1", "beta1")],
                    tol = 5e-3, check.attributes = FALSE)) # fitted coefficients
summary(Z. - Z) # standardized residuals


### Example 2: t_nu(0, (nu-2)/nu) innovations ##################################

## Generate data from a GARCH(1,1) with t_nu(0, (nu-2)/nu) innovations
uspec <- ugarchspec(variance.model = list(model = "sGARCH",
                                          garchOrder = c(1, 1)),
                    distribution.model = "std",
                    mean.model = list(armaOrder = c(0, 0)),
                    fixed.pars = list(mu = 0,
                                      omega = 0.1, # alpha_0
                                      alpha1 = 0.2, # alpha_1
                                      beta1 = 0.3, # beta_1
                                      shape = 4)) # nu
X <- ugarchpath(uspec, n.sim = 1e4, rseed = 271) # sample (set.seed() fails!)
X.t <- as.numeric(X@path$seriesSim) # actual path (X_t)

## Fitting via ugarchfit()
uspec. <- ugarchspec(variance.model = list(model = "sGARCH",
                                           garchOrder = c(1, 1)),
                     distribution.model = "std",
                     mean.model = list(armaOrder = c(0, 0)))
fit <- ugarchfit(uspec., data = X.t)
coef(fit) # fitted mu, alpha_0, alpha_1, beta_1, nu
Z <- fit@fit$z # standardized residuals
stopifnot(all.equal(mean(Z), 0, tol = 1e-2),
          all.equal(var(Z),  1, tol = 5e-2))

## Fitting via fit_GARCH_11()
fit. <- fit_GARCH_11(X.t, distr = "st")
c(fit.$coef, fit.$df) # fitted alpha_0, alpha_1, beta_1, nu
Z. <- fit.$Z.t # standardized residuals
stopifnot(all.equal(mean(Z.), 0, tol = 2e-2),
          all.equal(var(Z.),  1, tol = 2e-2))

## Compare
fit.coef <- coef(fit)[c("omega", "alpha1", "beta1", "shape")]
fit..coef <- c(fit.$coef, fit.$df)
stopifnot(all.equal(fit.coef, fit..coef, tol = 7e-2, check.attributes = FALSE))
summary(Z. - Z) # standardized residuals

qrmtools documentation built on May 29, 2024, 9:35 a.m.