Learn R Programming

gets (version 0.38)

regressorsVariance: Create regressors for a log-variance model

Description

The function creates the regressors of a log-variance model, e.g. in a arx model. The returned value is a matrix with the regressors and, by default, the regressand in the first column. 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, harch = NULL, asym = NULL,
  asymind = NULL, log.ewma = NULL, vxreg = NULL, prefix = "v", zero.adj = NULL,
  vc.adj = TRUE, return.regressand = TRUE, return.as.zoo = TRUE, na.trim = TRUE,
  na.omit = FALSE)

Value

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

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.

harch

either NULL (default) or an integer vector, say, c(5,20). The log of heterogenous ARCH-terms as proposed by Muller et al. (1997).

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.

asymind

either NULL (default) or an integer vector, say, c(1) or 1:3. The indicator ('binary') asymmetry 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. The log of heterogenous volatility proxies similar to those of Corsi (2009).

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.

prefix

a character used as prefix in the labelling of the variables in vxreg and of the intercept.

zero.adj

NULL (default) or a strictly positive numeric scalar. If NULL, the zeros in the squared e's are replaced by the 10 percent quantile of the non-zero squared e's. If zero.adj is a strictly positive numeric scalar, then this value is used to replace the zeros of the squared e's.

vc.adj

deprecated and ignored.

return.regressand

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

return.as.zoo

logical. TRUE (default) returns the matrix as a zoo object.

na.trim

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

na.omit

logical. FALSE (default) means NA-observations that are not in the beginning or at the end are kept (i.e. not omitted). TRUE removes with na.omit.

Author

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

References

Corsi, Fulvio (2009): 'A Simple Approximate Long-Memory Model of Realized Volatility', Journal of Financial Econometrics 7, pp. 174-196

Muller, Ulrich A., Dacorogna, Michel M., Dave, Rakhal D., Olsen, Richard B, Pictet, Olivier, Weizsaker, Jacob E. (1997): 'Volatilities of different time resolutions - Analyzing the dynamics of market components'. Journal of Empirical Finance 4, pp. 213-239

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

Run this code

##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)

##example where eps and x are 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)

Run the code above in your browser using DataLab