| Title: | Estimation and Exogenous Covariate Selection for ARCH-m(X), Additive ARCH-m(x), and GARCH-X Models |
|---|---|
| Description: | Estimates the parameters and nonparametric functions of an ARCH-m(X) model with exogenous covariates, estimates the parameters and nonparametric functions of an Additive ARCH-m(X) model with exogenous covariates, estimates the parameters of a GARCH-X model with exogenous covariates, performs hypothesis tests for the covariates returning the p-values, and performs stepwise variable selection on the exogenous covariates, and uses False Discovery Rate p-value corrections to select the exogenous variables. |
| Authors: | Adriano Zambom [aut, cre], Vincent Alegrete [aut], Elijah Sagaran [aut], Avni Israni [aut] |
| Maintainer: | Adriano Zambom <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 2.0 |
| Built: | 2026-05-24 06:08:16 UTC |
| Source: | https://github.com/cran/GARCH.X |
Fits an ARCH-m(X) model with given data and estimates the alphas and the nonparametric function m(X).
ARCHmX( eps, X, p, delta=2, covariates="all", hypothesisTest=TRUE, bandwidth = "plugin", k.choice = "plugin" )ARCHmX( eps, X, p, delta=2, covariates="all", hypothesisTest=TRUE, bandwidth = "plugin", k.choice = "plugin" )
eps |
Time series |
X |
Matrix with exogenous covariates where the number of rows is equal to the length of eps and columns represent the covariates. |
p |
Order of the ARCH-m(X) model. Value of p cannot be 0. |
delta |
Value of the power of the main time series for a POWER-GARCH, default is 2. |
covariates |
Instead of slicing X when building partial models, you can specify a vector of column indices. Defaults to "all". |
hypothesisTest |
Whether to perform covariate hypothesis testing, default is TRUE. |
bandwidth |
Choice of bandwidth for the Nadaraya-Watson Kernel regression estimation. Options are "plugin" or "CV". Default is "plugin". |
k.choice |
Choice of window size k for the ANOVA hypotghesis test. Options are "plugin" or "CV". Default is "plugin". |
Performs semiparametric estimation of and for the ARCH-m(X) model
Under the model, it can be shown that
A Nadaraya-Watson kernel is used to estimate as
This gives rise to a residual sum of squares
where
Non-negative least squares regression is used to obtain the final estimates of .
No variable selection is done in this function, but an ANOVA-type hypothesis test may be performed for the significance of each covariate. This is enabled by default.
An object of class ARCHmX
# We simulate a time series as in the simulate_ARCHmX example. set.seed(1) n <- 2000 alpha <- c(0.01, 0.02, 0.03) valinit <- 200 X <- matrix(rnorm((n + valinit) * 5), ncol = 5) m <- function(X) { abs(X[, 1]) } data <- sim.ARCHmX(n = n, alpha = alpha, m = m, X = X, delta = 2, valinit = valinit) p <- length(alpha) # Then we fit the model model <- ARCHmX(eps = data$eps, X = data$X, p=p) # Model summary shows Covariate 1 significant at the <0.001 level. summary(model)# We simulate a time series as in the simulate_ARCHmX example. set.seed(1) n <- 2000 alpha <- c(0.01, 0.02, 0.03) valinit <- 200 X <- matrix(rnorm((n + valinit) * 5), ncol = 5) m <- function(X) { abs(X[, 1]) } data <- sim.ARCHmX(n = n, alpha = alpha, m = m, X = X, delta = 2, valinit = valinit) p <- length(alpha) # Then we fit the model model <- ARCHmX(eps = data$eps, X = data$X, p=p) # Model summary shows Covariate 1 significant at the <0.001 level. summary(model)
Fits an Additive ARCH-m(X) model with given data and estimates the alphas and nonparametric functions m(X).
ARCHmXAdditive( eps, X, p, delta=2, covariates="all", method="smooth_means_Positive_Constraint_Exp", train_end = NULL, n_burn = 10, max_outer_iter = 30, tol = 1e-4, hypothesisTest=TRUE, k.choice = "plugin" )ARCHmXAdditive( eps, X, p, delta=2, covariates="all", method="smooth_means_Positive_Constraint_Exp", train_end = NULL, n_burn = 10, max_outer_iter = 30, tol = 1e-4, hypothesisTest=TRUE, k.choice = "plugin" )
eps |
Time series. |
||||||
X |
Matrix with exogenous covariates where the number of rows is equal to the length of eps and columns represent the covariates |
||||||
p |
Order of the Additive ARCH-m(X) model. Value of p cannot be 0. |
||||||
delta |
Value of the power of the main time series for a POWER-GARCH. Default is 2. |
||||||
covariates |
Instead of slicing X when building partial models, you can specify a vector of column indices. Defaults to "all". |
||||||
method |
Backfitting strategy used for the additive nonparametric component. One of
|
||||||
train_end |
Optional integer. If provided, fit on |
||||||
n_burn |
Integer burn-in. Iterations and fitted quantities are evaluated only after burn-in has passed. Default is 10. |
||||||
max_outer_iter |
Maximum number of outer backfitting iterations. Default is 30. |
||||||
tol |
Convergence tolerance for the outer iterations. Default is |
||||||
hypothesisTest |
Whether to perform covariate hypothesis testing, default is TRUE. |
||||||
k.choice |
Choice of window size k for the ANOVA hypotghesis test. Options are "plugin" or "CV". Default is "plugin". |
This function fits an additive semiparametric volatility model of the form
Estimation proceeds by iterating between:
Updating the ARCH parameters (subject to nonnegativity constraints), and
Updating the additive components using backfitting with a positivity-enforcing strategy controlled by method.
The outer loop stops when the change in the objective (or updates) is below tol or when max_outer_iter is reached.
No variable selection is done in this function, but an ANOVA-type hypothesis test may be performed for the significance of each covariate. This is enabled by default.
An object of class ARCHmXAdditive
# We simulate a time series as in the simulate.ARCHmXAdditive example. set.seed(1) n <- 2000 alpha <- c(0.2, 0.1) valinit <- 200 X <- matrix(rnorm((n+valinit) * 3), ncol = 3) m <- list( function(x) 4 * abs(sin(x)), function(x) 2 * x^2, function(x) 1.5 ) data <- sim.ARCHmXAdditive(n = n, alpha = alpha, X = X, m = m) p <- length(alpha) # Then we fit the model model <- ARCHmXAdditive(X = data$X, p = p, eps = data$eps, method = "smooth_means_lowes", max_outer_iter = 15) model$alphas model$converged # We inspect the model summary summary(model)# We simulate a time series as in the simulate.ARCHmXAdditive example. set.seed(1) n <- 2000 alpha <- c(0.2, 0.1) valinit <- 200 X <- matrix(rnorm((n+valinit) * 3), ncol = 3) m <- list( function(x) 4 * abs(sin(x)), function(x) 2 * x^2, function(x) 1.5 ) data <- sim.ARCHmXAdditive(n = n, alpha = alpha, X = X, m = m) p <- length(alpha) # Then we fit the model model <- ARCHmXAdditive(X = data$X, p = p, eps = data$eps, method = "smooth_means_lowes", max_outer_iter = 15) model$alphas model$converged # We inspect the model summary summary(model)
Fits a GARCHX model with given data and estimates the coefficients for omega, alpha, beta, and gamma
GARCHX( eps, X, order = c(1, 1), delta = 2, covariates = "all", optim.method = "NR" )GARCHX( eps, X, order = c(1, 1), delta = 2, covariates = "all", optim.method = "NR" )
eps |
Time series |
X |
Matrix with exogenous covariates where the number of rows is equal to the length of eps and columns represent the covariates. |
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. |
covariates |
Instead of slicing X when building partial models, you can specify a vector of column indices. Defaults to "all". |
optim.method |
Optimization method for maximizing quasi-likelihood function. Options: "NR", "L-BFGS-B", "GA", "PS", "SA". Default value is "NR". |
Uses the GARCHX model
To estimate the coefficients for
.
An object of class GARCHX
# We simulate a time-series as in the simulate.GARCHX example. set.seed(1) n <- 200 d <- 4 valinit <- 100 n2 <- n + d + 1 omega <- 0.05 alpha <- 0.05 beta <- 0.05 delta <- 2 gamma <- 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(gamma)) for(j in 1:d) X[, j] <- x[(d+2-j):(n+d+1-j+valinit)] data <- sim.GARCHX(n = n, omega = omega, alpha = alpha, beta = beta, delta = delta, X = X, gamma = gamma, valinit = valinit) # Then we fit the model model <- GARCHX(data$eps, data$X, order = c(1, 1), delta = 2, covariates = "all", optim.method = "NR") # We inspect the model summary summary(model)# We simulate a time-series as in the simulate.GARCHX example. set.seed(1) n <- 200 d <- 4 valinit <- 100 n2 <- n + d + 1 omega <- 0.05 alpha <- 0.05 beta <- 0.05 delta <- 2 gamma <- 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(gamma)) for(j in 1:d) X[, j] <- x[(d+2-j):(n+d+1-j+valinit)] data <- sim.GARCHX(n = n, omega = omega, alpha = alpha, beta = beta, delta = delta, X = X, gamma = gamma, valinit = valinit) # Then we fit the model model <- GARCHX(data$eps, data$X, order = c(1, 1), delta = 2, covariates = "all", optim.method = "NR") # We inspect the model summary summary(model)
Returns a sample ARCH-m(X) time series given s, data , and a function provided by the user. A vector of simulated s will be returned for every row in .
sim.ARCHmX(n, alpha, m, X, delta=2, shock.distr = "Normal", valinit=200 )sim.ARCHmX(n, alpha, m, X, delta=2, shock.distr = "Normal", valinit=200 )
n |
Desired length of simulated time series data |
alpha |
Set of parameters which determines the model's |
m |
The function to apply to |
X |
Matrix with exogenous covariates where each row is an observation. Must be compatible with |
delta |
Value of the power of the main time series for a POWER-GARCH, default is 2 |
shock.distr |
The distribution from which the epsilons will be simulated. Default is 'Normal', and must be one of 'Normal', 't5', 't7', or 'Laplace'. |
valinit |
How many cycles the simulation should spend warming up before returning samples. Default is 200 |
The user's specified s, , function , data , and shock distribution partially define an ARCH-m(X) time series
To get the simulations off the ground, a series of burn-in s are generated and used to build each . From here, the shock distribution is sampled to produce each .
A vector of simulated s corresponding to each observation (row) in .
set.seed(1) n <- 2000 alpha <- c(0.01, 0.02, 0.03) valinit <- 200 X <- matrix(rnorm((n + valinit) * 5), ncol = 5) m <- function(X) { abs(X[, 1]) } data <- sim.ARCHmX(n = n, alpha = alpha, m = m, X = X, delta = 2, valinit = valinit) summary(data$eps) plot(data$eps, type = "l", main = "Simulated ARCH-m(X) series")set.seed(1) n <- 2000 alpha <- c(0.01, 0.02, 0.03) valinit <- 200 X <- matrix(rnorm((n + valinit) * 5), ncol = 5) m <- function(X) { abs(X[, 1]) } data <- sim.ARCHmX(n = n, alpha = alpha, m = m, X = X, delta = 2, valinit = valinit) summary(data$eps) plot(data$eps, type = "l", main = "Simulated ARCH-m(X) series")
Returns a sample Additive ARCH-m(X) time series given s, data , and list of functions m provided by the user. A vector of simulated s will be returned for every row in .
sim.ARCHmXAdditive(n, alpha, m, X, delta = 2, valinit = 200, shock.distr = "Normal" )sim.ARCHmXAdditive(n, alpha, m, X, delta = 2, valinit = 200, shock.distr = "Normal" )
n |
Desired length of simulated time series data. |
alpha |
Set of parameters which determines the model's |
m |
List of length |
X |
Matrix with exogenous covariates where each row is an observation. Must be compatible with |
delta |
Value of the power of the main time series for a POWER-GARCH, default is 2. |
valinit |
Integer burn-in length used to stabilize the recursion before returning the simulated sample. Default is 200. |
shock.distr |
Innovation (shock) distribution for |
A vector of simulated s corresponding to each observation (row) in .
set.seed(1) n <- 2000 alpha <- c(0.2, 0.1) valinit <- 200 X <- matrix(rnorm((n+valinit) * 3), ncol = 3) m <- list( function(x) 4 * abs(sin(x)), function(x) 2 * x^2, function(x) 1.5 ) data <- sim.ARCHmXAdditive(n = n, alpha = alpha, X = X, m = m) summary(data$eps) plot(data$eps, type = "l", main = "Simulated additive ARCH-m(X) series")set.seed(1) n <- 2000 alpha <- c(0.2, 0.1) valinit <- 200 X <- matrix(rnorm((n+valinit) * 3), ncol = 3) m <- list( function(x) 4 * abs(sin(x)), function(x) 2 * x^2, function(x) 1.5 ) data <- sim.ARCHmXAdditive(n = n, alpha = alpha, X = X, m = m) summary(data$eps) plot(data$eps, type = "l", main = "Simulated additive ARCH-m(X) series")
Simulates Time series data from GARCH model with exogenous covariates
sim.GARCHX(n, omega, alpha, beta, gamma, X, delta = 2, shock.distr = "Normal", valinit = 200 )sim.GARCHX(n, omega, alpha, beta, gamma, X, delta = 2, shock.distr = "Normal", valinit = 200 )
n |
Desired length of simulated time series data. |
omega |
Coefficient value for omega, required to be
|
alpha |
ARCH Coefficient value, required to be
|
beta |
GARCH Coefficient value, required to be
|
gamma |
Vector containing coefficients for exogenous covariates. |
X |
Matrix with exogenous covariates where the number of rows is equal to the length of n + valinit |
delta |
Value of the power of the time series to allow for Power GARCHX, default is 2 for GARCHX |
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 |
A named list containing vector of Time Series data and X covariates used
set.seed(1) n <- 200 d <- 4 valinit <- 100 n2 <- n + d + 1 omega <- 0.05 alpha <- 0.05 beta <- 0.05 delta <- 2 gamma <- 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(gamma)) for(j in 1:d) X[, j] <- x[(d+2-j):(n+d+1-j+valinit)] data <- sim.GARCHX(n = n, omega = omega, alpha = alpha, beta = beta, delta = delta, X = X, gamma = gamma, valinit = valinit)set.seed(1) n <- 200 d <- 4 valinit <- 100 n2 <- n + d + 1 omega <- 0.05 alpha <- 0.05 beta <- 0.05 delta <- 2 gamma <- 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(gamma)) for(j in 1:d) X[, j] <- x[(d+2-j):(n+d+1-j+valinit)] data <- sim.GARCHX(n = n, omega = omega, alpha = alpha, beta = beta, delta = delta, X = X, gamma = gamma, valinit = valinit)
Returns the fitted ARCH-m(X), additive ARCH-m(X), or GARCHX model resulting from the specified stepwise selection algorithm.
stepwise( target_model, direction="forward", criterion="pvalue", adjust_method="fdr", alpha.level=0.05, trace = TRUE )stepwise( target_model, direction="forward", criterion="pvalue", adjust_method="fdr", alpha.level=0.05, trace = TRUE )
target_model |
A model object of class |
direction |
The mode of stepwise search, can be one of "forward", "backward", "both_null" (both directions starting with the empty model), "both_full" (both directions starting with the full model), "bestsubset", and "onepass", with a default of "forward". |
criterion |
The criterion for taking additional steps, default is "pvalue". |
adjust_method |
Correction for multiple testing accumulation of error. See p.adjust. |
alpha.level |
Defines the adjusted p-value significance level, default is 0.05. |
trace |
If 'TRUE', information is printed for each step of variable selection. Default is 'FALSE'. Offers summaries of prospective models as each predictor in the scope is added to or removed from the model. 'max_pvalue' indicates the maximum p-value from the multiple tests for each predictor in the model. |
The forward selection routine starts with a (null or empty) ARCH model. At each iteration, the current model is compared to an array of all possible models with one additional covariate. A forward step is taken to the candidate model with all significant covariates providing the most improvement in the specified criterion. If no such model exists, or if all covariates are exhausted, the current model is returned.
The backward selection routine starts with the full ARCH-m(X), additive ARCH-m(X), or GARCHX model with all possible covariates. At each iteration, the current model is compared to an array of all possible models with one covariate removed. A backward step is taken to the candidate model providing the most improvement in the specified criterion until a model is found with all significant covariates, or until the logic reaches the empty model.
The both_null and both_full selection routines start with the null and full models, respectively. At each iteration, both forward and backward steps are attempted as outlined above. This continues until no step is taken, and the current model will be returned. The pvalue criterion can not be used for these routines since the p-value contstraints for forward and backward selection are incompatible with one another.
The best_subset selection routine will build models for every possible combination of covariates and return the one with the best value for the specified criterion.
The onepass selection routine builds the full model and returns a new model containing every covariate identified as significant within the full model. The only criterion available for onepass is pvalue.
The user may specify p-value corrections to apply to the p-values used within the desired stepwise selection routine. All options provided by p.adjust are exposed to the user; the default is set to fdr.
The final model chosen by the stepwise-selection process.
# We simulate a time series as in the simulate_ARCHmX example. set.seed(1) n <- 2000 alpha <- c(0.01, 0.02, 0.03) valinit <- 200 X <- matrix(rnorm((n + valinit) * 5), ncol = 5) m <- function(X) { abs(X[, 1]) } data <- sim.ARCHmX(n = n, alpha = alpha, m = m, X = X, delta = 2, valinit = valinit) p <- length(alpha) # Output will show the trace from the empty model to the model with Covariate 1, # which is returned as stepwise_model. target_ARCHmX_model <- ARCHmX(X = data$X, p = p, eps = data$eps) stepwise_model <- stepwise(target_ARCHmX_model, direction="forward", criterion="pvalue")# We simulate a time series as in the simulate_ARCHmX example. set.seed(1) n <- 2000 alpha <- c(0.01, 0.02, 0.03) valinit <- 200 X <- matrix(rnorm((n + valinit) * 5), ncol = 5) m <- function(X) { abs(X[, 1]) } data <- sim.ARCHmX(n = n, alpha = alpha, m = m, X = X, delta = 2, valinit = valinit) p <- length(alpha) # Output will show the trace from the empty model to the model with Covariate 1, # which is returned as stepwise_model. target_ARCHmX_model <- ARCHmX(X = data$X, p = p, eps = data$eps) stepwise_model <- stepwise(target_ARCHmX_model, direction="forward", criterion="pvalue")