regressorsVariance: Create the regressors of the variance equation

View source: R/gets-base-source.R

regressorsVarianceR Documentation

Create the regressors of the variance equation

Description

The function generates the regressors of the log-variance equation in an arx model. The returned value is a matrix with the regressors and, by default, the regressand in column one. By default, observations (rows) with missing values are removed in the beginning and the end with na.trim, and the returned matrix is a zoo object.

Usage

regressorsVariance(e, vc = TRUE, arch = NULL, asym = NULL,
  log.ewma = NULL, vxreg = NULL, zero.adj = 0.1, vc.adj = TRUE,
  return.regressand = TRUE, return.as.zoo = TRUE, na.trim = TRUE,
  na.omit = FALSE)

Arguments

e

numeric vector, time-series or zoo object.

vc

logical. TRUE includes an intercept in the log-variance specification, whereas FALSE (default) does not. If the log-variance specification contains any other item but the log-variance intercept, then vc is set to TRUE

arch

either NULL (default) or an integer vector, say, c(1,3) or 2:5. The log-ARCH lags to include in the log-variance specification

asym

either NULL (default) or an integer vector, say, c(1) or 1:3. The asymmetry (i.e. 'leverage') terms to include in the log-variance specification

log.ewma

either NULL (default) or a vector of the lengths of the volatility proxies, see leqwma

vxreg

either NULL (default) or a numeric vector or matrix, say, a zoo object, of conditioning variables. If both y and mxreg are zoo objects, then their samples are chosen to match

zero.adj

numeric value between 0 and 1. The quantile adjustment for zero values. The default 0.1 means the zero residuals are replaced by the 10 percent quantile of the absolute residuals before taking the logarithm

vc.adj

logical. If TRUE (default), then the log-variance intercept is adjusted by the estimate of E[ln(z^2)], where z is the standardised error. This adjustment is needed for the conditional scale to be equal to the conditional standard deviation. If FALSE, then the log-variance intercept is not adjusted

return.regressand

logical. TRUE, the default, includes the regressand as column one in the returned matrix.

return.as.zoo

TRUE, the default, returns the matrix as a zoo object.

na.trim

TRUE, the default, removes observations with NA-values in the beginning and the end with na.trim.

na.omit

TRUE, the non-default, removes observations with NA-values, not necessarily in the beginning or in the end, with na.omit.

Value

A matrix, by default of class zoo, with the regressand as column one (the default).

Author(s)

Genaro Sucarrat, http://www.sucarrat.net/

References

Pretis, Felix, Reade, James and Sucarrat, Genaro (2018): 'Automated General-to-Specific (GETS) Regression Modeling and Indicator Saturation for Outliers and Structural Breaks'. Journal of Statistical Software 86, Number 3, pp. 1-44. DOI: https://www.jstatsoft.org/article/view/v086i03

Sucarrat, Genaro and Escribano, Alvaro (2012): 'Automated Financial Model Selection: General-to-Specific Modelling of the Mean and Volatility Specifications', Oxford Bulletin of Economics and Statistics 74, Issue 5 (October), pp. 716-735

See Also

regressorsMean, arx, zoo, leqwma, na.trim and na.omit.

Examples


##generate some data:
eps <- rnorm(10) #error term
x <- matrix(rnorm(10*5), 10, 5) #regressors

##create regressors (examples):
regressorsVariance(eps, vxreg=x)
regressorsVariance(eps, vxreg=x, return.regressand=FALSE)
regressorsVariance(eps, arch=1:3, vxreg=x)
regressorsVariance(eps, arch=1:2, asym=1, vxreg=x)
regressorsVariance(eps, arch=1:2, asym=1, log.ewma=5)

##let eps and x be time-series:
eps <- ts(eps, frequency=4, end=c(2018,4))
x <- ts(x, frequency=4, end=c(2018,4))
regressorsVariance(eps, vxreg=x)
regressorsVariance(eps, arch=1:3, vxreg=x)
regressorsVariance(eps, arch=1:2, asym=1, vxreg=x)
regressorsVariance(eps, arch=1:2, asym=1, log.ewma=5)


gets documentation built on Oct. 10, 2022, 1:06 a.m.