Title: Estimation and Exogenous Covariate Selection for GARCH-X Models
Version: 1.0
Description: Estimates the parameters of a GARCH-X model with exogenous covariates, performs hypothesis tests for the parameters returning the p-values, and uses False Discovery Rate p-value corrections to select the exogenous variables.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
Encoding: UTF-8
RoxygenNote: 7.3.2
Imports: GA, GenSA, pso, stats
NeedsCompilation: no
Packaged: 2025-06-13 23:07:41 UTC; azambom
Author: Adriano Zambom [aut, cre], Elijah Sagaran [aut]
Maintainer: Adriano Zambom <adriano.zambom@csun.edu>
Repository: CRAN
Date/Publication: 2025-06-17 06:00:06 UTC

AIC for GARCHX model

Description

Calculates the Akaike Information Criterion for GARCHX model

Usage

AIC(model)

Arguments

model

GARCHX object

Value

AIC of GARCHX model

Examples

set.seed(123)
pi <- c(1, 0, 0, 4)
n <- 2000
d <- length(pi)
valinit <- 100
n2 <- n + d + 1
omega <- 0.1
alpha <- 0.2
beta <- 0.3
delta <- 2
e<-rnorm(n2+valinit)
Y<-e
for (t in 2:n2)
 Y[t]<- 0.2*Y[t-1]+e[t]
x<-exp(Y)
X <- matrix(0, nrow = (n+valinit), ncol = length(pi))
for(j in 1:d)
 X[, j] <- x[(d+2-j):(n+d+1-j+valinit)]
data <- GARCH.X::simulate(n, omega, alpha, beta, delta, X, pi, valinit = valinit)
model <- GARCHX_select(eps = data$eps, X = data$X)
AIC_value <- AIC(model)

BIC for GARCHX model

Description

Calculates the Bayesian Information Criterion of the GARCHX model

Usage

BIC(model)

Arguments

model

GARCHX object

Value

BIC of GARCHX model

Examples

set.seed(123)
pi <- c(1, 0, 0, 4)
n <- 2000
d <- length(pi)
valinit <- 100
n2 <- n + d + 1
omega <- 0.1
alpha <- 0.2
beta <- 0.3
delta <- 2
e<-rnorm(n2+valinit)
Y<-e
for (t in 2:n2)
 Y[t]<- 0.2*Y[t-1]+e[t]
x<-exp(Y)
X <- matrix(0, nrow = (n+valinit), ncol = length(pi))
for(j in 1:d)
 X[, j] <- x[(d+2-j):(n+d+1-j+valinit)]
data <- GARCH.X::simulate(n, omega, alpha, beta, delta, X, pi, valinit = valinit)
model <- GARCHX_select(eps = data$eps, X = data$X)
BIC_value <- BIC(model)

Fitting GARCHX model for variable selection

Description

Fits a GARCHX model with given data and estimates the coefficients for omega, alpha, beta, and pi

Usage

GARCHX(
  eps,
  X,
  order = c(1, 1),
  delta = 2,
  optim.method = "NR"
)

Arguments

eps

Time series

X

Matrix with exogenous covariates where the number of rows is equal to the length of eps

order

Order of the GARCH model. Value of p cannot be 0

delta

Value of the power of the main time series to allow for Power GARCHX, default is 2 for GARCHX

optim.method

Optimization method for maximizing quasi-likelihood function. Options: "NR", "L-BFGS-B", "GA", "PS", "SA". Default value is "NR"

Details

Uses the GARCHX model

\mathcal{E}_t = \sigma_tw_t

\sigma^2_t = \omega_0 + \sum^{p}_{i=1}\alpha_i\mathcal{E}_{t-i}^2 + \sum^q_{j=1}\beta_j\sigma^2_{t-j}+\mathbf{\pi}^T\mathbf{x}_{t-1}

To estimate the coefficients for

\omega, \alpha, \beta, \pi

. No variable selection is done in this function.

Value

An object of class GARCHX


Variable selection for exogenous covariates in GARCHX models

Description

Performs variable selection on the exogenous covariates through testing each covariate in X and correcting the p-values for multiple testing.

Usage

GARCHX_select(
  eps,
  X,
  order = c(1, 1),
  delta = 2,
  alpha.level = 0.05,
  adjust.method = "fdr",
  optim.method = "NR"
)

Arguments

eps

Time series data

X

Matrix with exogenous covariates where the number of rows is equal to the length of eps

order

Order of the GARCH model. Value of p cannot be 0.

delta

Value of the power of the main time series to allow for Power GARCHX, default is 2 for GARCHX

alpha.level

Alpha level for p-value cut-off in variable selection

adjust.method

Multiple testing p-value adjustment, see p.adjust. Possible values are "holm", "hochberg", "hommel", "bonferonni", "BH", "BY", "fdr", "none"

optim.method

Optimization method for maximizing quasi-likelihood function. Options: "NR", "L-BFGS-B", "GA", "PS", "SA". Default value is "NR"

Details

Using the GARCHX model

\mathcal{E}_t = \sigma_tw_t

\sigma^2_t = \omega_0 + \sum^{p}_{i=1}\alpha_i\mathcal{E}_{t-i}^2 + \sum^q_{j=1}\beta_j\sigma^2_{t-j}+\mathbf{\pi}^T\mathbf{x}_{t-1}

performs variable selection by testing

H_0: \pi_j = 0, \forall j

and compares the p-values to the adjusted alpha level according to adjust.method. If alpha.level = 1, then no variable selection is performed and the function only estimates the parameters

Value

An object of class GARCHX

References

Francq, C. and Thieu, L.Q.(2018). QML Inference for Volatility Models with Covariates. Econometric Theory, Cambridge University Press

Examples

set.seed(123)
pi <- c(1, 0, 0, 4)
n <- 2000
d <- length(pi)
valinit <- 100
n2 <- n + d + 1
omega <- 0.1
alpha <- 0.2
beta <- 0.3
delta <- 2
e<-rnorm(n2+valinit)
Y<-e
for (t in 2:n2)
 Y[t]<- 0.2*Y[t-1]+e[t]
x<-exp(Y)
X <- matrix(0, nrow = (n+valinit), ncol = length(pi))
for(j in 1:d)
 X[, j] <- x[(d+2-j):(n+d+1-j+valinit)]
data <- GARCH.X::simulate(n, omega, alpha, beta, delta, X, pi, valinit = valinit)
model <- GARCHX_select(eps = data$eps, X = data$X)


Predict GARCHX future time series values

Description

Predicts values for GARCHX model

Usage

predict(model, X, n_pred)

Arguments

model

GARCHX object

X

Exogenous covariates for predictions

n_pred

Number of predictions into the future

Value

Vector of predicted time series data

References

Francq, C. and Thieu, L.Q.(2018). QML Inference for Volatility Models with Covariates. Econometric Theory, Cambridge University Press

Examples

set.seed(123)
pi <- c(1, 0, 0, 4)
n <- 2000
d <- length(pi)
valinit <- 100
n2 <- n + d + 1
omega <- 0.1
alpha <- 0.2
beta <- 0.3
delta <- 2
e<-rnorm(n2+valinit)
Y<-e
for (t in 2:n2)
 Y[t]<- 0.2*Y[t-1]+e[t]
x<-exp(Y)
X <- matrix(0, nrow = (n+valinit), ncol = length(pi))
for(j in 1:d)
 X[, j] <- x[(d+2-j):(n+d+1-j+valinit)]
data <- GARCH.X::simulate(n, omega, alpha, beta, delta, X, pi, valinit = valinit)
model <- GARCHX_select(eps = data$eps, X = data$X)
n_pred = 10
test.X <- data$X[(n-n_pred+1):n, ]
predictions <- predict(model = model, X = test.X, n_pred = n_pred)


Simulate GARCHX model

Description

Simulates Time series data from GARCH model with exogenous covariates

Usage

simulate(n, omega, alpha, beta, delta = 2, X, pi, shock.distr = "Normal", valinit = 200)

Arguments

n

Desired length of simulated time series data

omega

Coefficient value for omega, required to be

\omega_0 > 0

alpha

ARCH Coefficient value, required to be

\alpha_0 \geq 0

beta

GARCH Coefficient value, required to be

\beta_0 \geq 0

delta

Value of the power of the time series to allow for Power GARCHX, default is 2 for GARCHX

X

Matrix with exogenous covariates where the number of rows is equal to the length of n + valinit

pi

Vector containing coefficients for exogenous covariates.

shock.distr

Distribution of the shock eta_t that multiply w_t in the GARCH-X model eps_ = w_t*eta_t.

valinit

Initialization value, default value is 200

Value

A named list containing vector of Time Series data and X covariates used

Examples

n <- 200
d <- 4
valinit <- 100
n2 <- n + d + 1
omega <- 0.05
alpha <- 0.05
beta <- 0.05
delta <- 2
pi <- rep(0.05, d)
e<-rnorm(n2+valinit)
Y<-e
for (t in 2:n2)
 Y[t]<- 0.2*Y[t-1]+e[t]
x<-exp(Y)
X <- matrix(0, nrow = (n+valinit), ncol = length(pi))
for(j in 1:d)
 X[, j] <- x[(d+2-j):(n+d+1-j+valinit)]
data <- simulate(n, omega, alpha, beta, delta, X, pi, valinit = valinit)