Learn R Programming

fEGarch (version 1.0.1)

rugarch_wrappers: Wrapper Functions for Selected rugarch GARCH Models

Description

Easy to use functions for fitting selected GARCH-type models from the widely-known rugarch package by Ghalanos (2024). These functions are meant as an easy to use way to compare the main results from rugarch to the newly established models in the fEGarch package and are by no means considered to be a replacement of rugarch.

Usage

aparch_ru(
  rt,
  orders = c(1, 1),
  cond_dist = c("norm", "std", "ged", "snorm", "sstd", "sged"),
  meanspec = mean_spec(),
  nonparspec = locpol_spec(),
  use_nonpar = FALSE,
  n_test = 0,
  start_pars = NULL,
  control_nonpar = list()
)

gjrgarch_ru( rt, orders = c(1, 1), cond_dist = c("norm", "std", "ged", "snorm", "sstd", "sged"), meanspec = mean_spec(), nonparspec = locpol_spec(), use_nonpar = FALSE, n_test = 0, start_pars = NULL, control_nonpar = list() )

egarch_ru( rt, orders = c(1, 1), cond_dist = c("norm", "std", "ged", "snorm", "sstd", "sged"), meanspec = mean_spec(), nonparspec = locpol_spec(), use_nonpar = FALSE, n_test = 0, start_pars = NULL, control_nonpar = list() )

Value

A list with the following named elements is returned.

pars:

a named numeric vector with the parameter estimates.

se:

a named numeric vector with the obtained standard errors in accordance with the parameter estimates.

vcov_mat:

the variance-covariance matrix of the parameter estimates with named columns and rows.

rt:

the input object rt (or at least the training data, if n_test is greater than zero); if rt was a "zoo" or "ts" object, the formatting is kept.

cmeans:

the estimated conditional means; if rt was a "zoo" or "ts" object, the formatting is also applied to cmeans.

sigt:

the estimated conditional standard deviations (or for use_nonpar = TRUE the estimated total volatilities, i.e. scale function value times conditional standard deviation); if rt was a "zoo" or "ts" object, the formatting is also applied to sigt.

etat:

the obtained residuals; if rt was a "zoo" or "ts" object, the formatting is also applied to etat.

orders:

a two-element numeric vector stating the considered model orders.

cond_dist:

a character value stating the conditional distribution considered in the model fitting.

llhood:

the log-likelihood value obtained at the optimal parameter combination.

inf_criteria:

a named two-element numeric vector with the corresponding AIC (first element) and BIC (second element) of the fitted model.

rugarch_model:

the estimation object returned by ugarchfit() of the rugarch package (Ghalanos, 2024).

meanspec:

the settings for the model in the conditional mean; is an object of class "mean_spec" that is identical to the object passed to the input argument meanspec.

test_obs:

the observations at the end up the input rt reserved for testing following n_test.

scale_fun:

the estimated scale function values, if use_nonpar = TRUE, otherwise NULL; formatting of rt is reused.

nonpar_model:

the estimation object returned by tsmoothlm for use_nonpar = TRUE.

Arguments

rt

the input time series to fit the model to ordered from past to present; can also be a "zoo" class object or a "ts" class object.

orders

the ARCH and GARCH orders of the model as a two-element numeric vector.

cond_dist

a single-element character vector with the conditional distribution to consider.

meanspec

an object of class "mean_spec"; indicates the specifications for the model in the conditional mean.

nonparspec

an object of class "locpol_spec" returned by locpol_spec; defines the settings of the nonparametric smoothing technique for use_nonpar = TRUE.

use_nonpar

a logical indicating whether or not to implement a semiparametric extension of the volatility model defined through spec; see "Details" for more information.

n_test

a single numerical value indicating, how many observations at the end of rt not to include in the fitting process and to reserve for backtesting.

start_pars

a named list with starting parameters.

control_nonpar

a list containing changes to the arguments for the hyperparameter estimation algorithm in the nonparametric scale function estimation for use_nonpar = TRUE; see "Details" for more information.

Details

For most details, please see the documentation of the rugarch package (Ghalanos, 2024).

These functions also provide an extension, so that a nonparametric, smooth scale function in the unconditional standard deviation can be estimated before the parametric step. If use_nonpar = TRUE, meanspec is omitted and before fitting a zero-mean model in the conditional volatility following the remaining function arguments, a smooth scale function, i.e. a function representing the unconditional standard deviation over time, is being estimated following the specifications in nonparspec and control_nonpar. This preliminary step stabilizes the input series rt, as long-term changes in the unconditional variance are being estimated and removed before the parametric step using tsmooth. control_nonpar can be adjusted following to make changes to the arguments of tsmooth for short-memory specifications. These arguments specify settings for the automated bandwidth selection algorithms implemented by this function. By default, we use the settings Mcf = "NP", InfR = "Nai", bStart = 0.15, bvc = "Y", cb = 0.05, and method = "lpr" for tsmooth. locpol_spec passed to nonparspec handles more direct settings of the local polynomial smoother itself. See the documentation for these functions to get a detailed overview of these settings. Assume \(\{r_t\}\) to be the observed series, where \(t = 1, 2, \dots, n\), then \(r_t^{*} = r_t - \bar{r}\), with \(\bar{r}\) being the arithmetic mean over the observed \(r_t\), is computed and subsequently \(y_t = \ln\left[\left(r_t^{*}\right)^2\right]\). The subtraction of \(\bar{r}\) is necessary so that \(r_t^{*}\) are all different from zero almost surely. Once \(y_t\) are available, its trend \(m(x_t)\), with \(x_t\) as the rescaled time on the interval \([0, 1]\), is being estimated using tsmoothlm and denoted here by \(\hat{m}(x_t)\). Then from \(\hat{\xi}_t = y_t - \hat{m}(x_t)\) obtain \(\hat{C} = -\ln\left\{\sum_{t=1}^{n}\exp\left(\hat{\xi}_t\right)\right\}\), and obtain the estimated scale function as \(\hat{s}(x_t)=\exp\left[\left(\hat{\mu}(x_t) - \hat{C}\right) / 2\right]\). The stabilized / standardized version of the series \(\left\{r_t\right\}\) is then \(\tilde{r}_t = r_t^{*} / \hat{s}(x_t)\), to which a purely parametric volatility model following the remaining function arguments is then fitted. The estimated volatility at a given time point is then the product of the estimate of the corresponding scale function value and of the estimated conditional standard deviation (following the parametric model part) for that same time point. See for example Feng et al. (2022) or Letmathe et al. (2023) for more information on the semiparametric extension of volatility models.

References

  • Feng, Y., Gries, T., Letmathe, S., & Schulz, D. (2022). The smoots Package in R for Semiparametric Modeling of Trend Stationary Time Series. The R Journal, 14(1), 182-195. URL: https://journal.r-project.org/articles/RJ-2022-017/.

  • Ghalanos, A. (2024). rugarch: Univariate GARCH models. R package version 1.5-3. DOI: 10.32614/CRAN.package.rugarch.

  • Letmathe, S., Beran, J., & Feng, Y. (2023). An extended exponential SEMIFAR model with application in R. Communications in Statistics - Theory and Methods, 53(22), 7914–7926. DOI: 10.1080/03610926.2023.2276049.

Examples

Run this code
est <- gjrgarch_ru(SP500)
est@pars
est@se
plot(est@sigt)

Run the code above in your browser using DataLab