Learn R Programming

gets (version 0.38)

arx: Estimate an AR-X model with log-ARCH-X errors

Description

Estimation by OLS, two-step OLS if a variance specification is specified: In the first the mean specification (AR-X) is estimated, whereas in the second step the log-variance specification (log-ARCH-X) is estimated.

The AR-X mean specification can contain an intercept, AR-terms, lagged moving averages of the regressand and other conditioning covariates ('X'). The log-variance specification can contain log-ARCH terms, asymmetry or 'leverage' terms, log(EqWMA) where EqWMA is a lagged equally weighted moving average of past squared residuals (a volatility proxy) and other conditioning covariates ('X').

Usage

arx(y, mc=TRUE, ar=NULL, ewma=NULL, mxreg=NULL, vc=FALSE,
  arch=NULL, asym=NULL, log.ewma=NULL, vxreg=NULL, zero.adj=NULL,
  vc.adj=TRUE, vcov.type=c("ordinary", "white", "newey-west"),
  qstat.options=NULL, normality.JarqueB=FALSE, user.estimator=NULL,
  user.diagnostics=NULL, tol=1e-07, LAPACK=FALSE, singular.ok=TRUE,
  plot=NULL)

Value

A list of class 'arx'

Arguments

y

numeric vector, time-series or zoo object. Missing values in the beginning and at the end of the series is allowed, as they are removed with the na.trim command

mc

logical. TRUE (default) includes an intercept in the mean specification, whereas FALSE does not

ar

either NULL (default) or an integer vector, say, c(2,4) or 1:4. The AR-lags to include in the mean specification. If NULL, then no lags are included

ewma

either NULL (default) or a list with arguments sent to the eqwma function. In the latter case a lagged moving average of y is included as a regressor

mxreg

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

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

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

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

vcov.type

character vector, "ordinary" (default), "white" or "newey-west". If "ordinary", then the ordinary variance-covariance matrix is used for inference. If "white", then the White (1980) heteroscedasticity-robust matrix is used. If "newey-west", then the Newey and West (1987) heteroscedasticity and autocorrelation-robust matrix is used

qstat.options

NULL (default) or an integer vector of length two, say, c(1,1). The first value sets the lag-order of the AR diagnostic test, whereas the second value sets the lag-order of the ARCH diagnostic test. If NULL, then the two values of the vector are set automatically

normality.JarqueB

FALSE (default) or TRUE. If TRUE, then the results of the Jarque and Bera (1980) test for non-normality in the residuals are included in the estimation results.

user.estimator

NULL (default) or a list with one entry, name, containing the name of the user-defined estimator. Additional items, if any, are passed on as arguments to the estimator in question

user.diagnostics

NULL (default) or a list with two entries, name and pval, see the user.fun argument in diagnostics

tol

numeric value (default = 1e-07). The tolerance for detecting linear dependencies in the columns of the regressors (see qr function). Only used if LAPACK is FALSE (default) and user.estimator is NULL.

LAPACK

logical. If TRUE, then use LAPACK. If FALSE (default), then use LINPACK (see qr function). Only used if user.estimator is NULL.

singular.ok

logical. If TRUE (default), the regressors are checked for singularity, and the ones causing it are automatically removed.

plot

NULL or logical. If TRUE, the fitted values and the residuals are plotted. If NULL (default), then the value set by options determines whether a plot is produced or not.

Details

For an overview of the AR-X model with log-ARCH-X errors, see Pretis, Reade and Sucarrat (2018): tools:::Rd_expr_doi("10.18637/jss.v086.i03").

The arguments user.estimator and user.diagnostics enables the specification of user-defined estimators and user-defined diagnostics. To this end, the principles of the same arguments in getsFun are followed, see its documentation under "Details", and Sucarrat (2020): https://journal.r-project.org/archive/2021/RJ-2021-024/.

References

C. Jarque and A. Bera (1980): 'Efficient Tests for Normality, Homoscedasticity and Serial Independence'. Economics Letters 6, pp. 255-259. tools:::Rd_expr_doi("10.1016/0165-1765(80)90024-5")

Felix Pretis, James Reade and Genaro Sucarrat (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. tools:::Rd_expr_doi("10.18637/jss.v086.i03")

Genaro Sucarrat (2020): 'User-Specified General-to-Specific and Indicator Saturation Methods'. The R Journal 12:2, pages 388-401. https://journal.r-project.org/archive/2021/RJ-2021-024/

Halbert White (1980): 'A Heteroskedasticity-Consistent Covariance Matrix Estimator and a Direct Test for Heteroskedasticity', Econometrica 48, pp. 817-838.

Whitney K. Newey and Kenned D. West (1987): 'A Simple, Positive Semi-Definite, Heteroskedasticity and Autocorrelation Consistent Covariance Matrix', Econometrica 55, pp. 703-708.

See Also

Extraction functions (mostly S3 methods): coef.arx, ES, fitted.arx, plot.arx,
print.arx, recursive, residuals.arx, sigma.arx, rsquared,
summary.arx, VaR and vcov.arx

Related functions: getsm, getsv, isat

Examples

Run this code
##Simulate from an AR(1):
set.seed(123)
y <- arima.sim(list(ar=0.4), 70)

##estimate an AR(2) with intercept:
arx(y, mc=TRUE, ar=1:2)

##Simulate four independent Gaussian regressors:
xregs <- matrix(rnorm(4*70), 70, 4)

##estimate an AR(2) with intercept and four conditioning
##regressors in the mean:
arx(y, ar=1:2, mxreg=xregs)

##estimate a log-variance specification with a log-ARCH(4)
##structure:
arx(y, mc=FALSE, arch=1:4)

##estimate a log-variance specification with a log-ARCH(4)
##structure and an asymmetry/leverage term:
arx(y, mc=FALSE, arch=1:4, asym=1)

##estimate a log-variance specification with a log-ARCH(4)
##structure, an asymmetry or leverage term, a 10-period log(EWMA) as
##volatility proxy, and the log of the squareds of the conditioning
##regressors in the log-variance specification:
arx(y, mc=FALSE,
  arch=1:4, asym=1, log.ewma=list(length=10), vxreg=log(xregs^2))

##estimate an AR(2) with intercept and four conditioning regressors
##in the mean, and a log-variance specification with a log-ARCH(4)
##structure, an asymmetry or leverage term, a 10-period log(EWMA) as
##volatility proxy, and the log of the squareds of the conditioning
##regressors in the log-variance specification:
arx(y, ar=1:2, mxreg=xregs,
  arch=1:4, asym=1, log.ewma=list(length=10), vxreg=log(xregs^2))

Run the code above in your browser using DataLab