Learn R Programming

tvReg (version 0.5.6)

tvAR: Time-Varying Autoregressive Model

Description

tvAR is used to fit an autorregressive model with time varying coefficients.

Usage

tvAR(
  y,
  p = 1,
  z = NULL,
  ez = NULL,
  bw = NULL,
  cv.block = 0,
  type = c("const", "none"),
  exogen = NULL,
  fixed = NULL,
  est = c("lc", "ll"),
  tkernel = c("Triweight", "Epa", "Gaussian"),
  singular.ok = TRUE
)

Arguments

y

A vector with the dependent variable.

p

A scalar indicating the number of lags in the model.

z

A vector with the smoothing variable.

ez

(optional) A scalar or vector with the smoothing estimation values. If values are included then the vector z is used.

bw

An opcional scalar or vector of length the number of equations. It represents the bandwidth in the estimation of coefficients. If NULL, it is selected by cross validation.

cv.block

A positive scalar with the size of the block in leave one block out cross-validation. By default 'cv.block=0' meaning leave one out cross-validation.

type

A character 'const' if the model contains an intercept and 'none' otherwise.

exogen

A matrix or data.frame with the exogenous variables (optional)

fixed

(optional) numeric vector of the same length as the total number of parameters. The order of the parameters is intercept (if type = "const"), lags in ascending order and exogenous variables. If supplied, only NA entries in fixed will be estimated.

est

The nonparametric estimation method, one of "lc" (default) for linear constant or "ll" for local linear.

tkernel

A character, either "Triweight" (default), "Epa" or "Gaussian" kernel function.

singular.ok

Logical. If FALSE, a singular model is an error.

Value

An object of class tvar with the following components:

coefficients

A vector of dimension obs (obs = number of observations - number lags), with the time-varying coefficients estimates.

fitted

The fitted values.

residuals

Estimation residuals.

x

A matrix of model data, with lagged y and exogenous variables.

y

A vector with the dependent data used in the model.

z

A vector with the smoothing variable in the model.

ez

A vector with the smoothing estimation values.

y.orig

A vector with the original variable y.

bw

Bandwidth of mean estimation.

type

Whether the model has a constant or not.

exogen

A matrix or data.frame with other exogenous variables.

p

Number of lags

obs

Number of observations in estimation.

totobs

Number of observations in the original set.

level

Confidence interval range.

runs

Number of bootstrap replications.

tboot

Type of bootstrap.

BOOT

List with all bootstrap replications of coefficients, if done.

Details

It is a special case of linear model in which the regressors are lags of the dependent variable. If any variable is included in the xreg term, these are added to the regressors matrix. A time-varying coefficients linear regression (with an intercept if type = "const") is fitted.

References

Cai, Z. (2007) Trending time-varying coefficient time series with serially correlated errors, Journal of Econometrics, 136, pp. 163-188.

Casas, I., Mao, X. and Veiga, H. (2018) Reexamining financial and economic predictability with new estimators of realized variance and variance risk premium. Url= http://pure.au.dk/portal/files/123066669/rp18_10.pdf

Chen, X. B., Gao, J., Li, D., and Silvapulle, P (2017) Nonparametric estimation and forecasting for time-varying coefficient realized volatility models, Journal of Business \& Economic Statistics, online, 1-13.

Corsi, F. (2009) A simple approximate long-memory model of realized volatility. Journal of Financial Econometrics, 7, 174-196.

See Also

bw, tvLM, confint, plot, print and summary

Examples

Run this code
# NOT RUN {
## Estimate coefficients of different realized variance models
data("RV")
RV2 <- head(RV, 2000)
RV <- RV2$RV
RV_week <- RV2$RV_week
RV_month <- RV2$RV_month
RQ <- RV2$RQ_lag_sqrt
##Corsi (2009) HAR model
HAR <- arima(RV, order = c(1, 0, 0), xreg = cbind (RV_week, RV_month))
print(HAR)

##Chen et al (2017) TVCHAR model 
TVCHAR <- tvAR (RV, p = 1, exogen = cbind (RV_week, RV_month), bw = 20)
print(TVCHAR)

##Casas et al (2018) TVHARQ model
TVHARQ <- tvAR (RV, p = 1, exogen = cbind (RV_week, RV_month), 
z=RQ, bw = 0.0062)
print(TVHARQ)

# }

Run the code above in your browser using DataLab