CI {timevarcorr}R Documentation

Internal functions for the computation of confidence intervals

Description

These functions compute the different terms required for tcor() to compute the confidence interval around the time-varying correlation coefficient. These terms are defined in Choi & Shin (2021).

Usage

calc_H(smoothed_obj)

calc_e(smoothed_obj, H)

calc_Gamma(e, l)

calc_GammaINF(e, L)

calc_L_And(e, AR.method = c("yule-walker", "burg", "ols", "mle", "yw"))

calc_D(smoothed_obj)

calc_SE(
  smoothed_obj,
  h,
  AR.method = c("yule-walker", "burg", "ols", "mle", "yw")
)

Arguments

smoothed_obj

an object created with calc_rho.

H

an object created with calc_H.

e

an object created with calc_e.

l

a scalar indicating a number of time points.

L

a scalar indicating a bandwidth parameter.

AR.method

character string specifying the method to fit the autoregressive model used to compute γ^1\hat{\gamma}_1 in LAndL_{And} (see stats::ar for details).

h

a scalar indicating the bandwidth used by the smoothing function.

Value

Functions

References

Choi, JE., Shin, D.W. Nonparametric estimation of time varying correlation coefficient. J. Korean Stat. Soc. 50, 333–353 (2021). doi:10.1007/s42952-020-00073-6

Andrews, D. W. K. Heteroskedasticity and autocorrelation consistent covariance matrix estimation. Econometrica: Journal of the Econometric Society, 817-858 (1991).

See Also

tcor()

Examples

rho_obj <- with(na.omit(stockprice),
                calc_rho(x = SP500, y = FTSE100, t = DateID, h = 20, kernel = "box"))
head(rho_obj)

## Computing \eqn{\hat{H_t}}

H <- calc_H(smoothed_obj = rho_obj)
H[, , 1:2] # H array for the first two time points

## Computing \eqn{\hat{e}_t}

e <- calc_e(smoothed_obj = rho_obj, H = H)
head(e) # e matrix for the first six time points

## Computing \eqn{\hat{\Gamma}_l}

calc_Gamma(e = e, l = 3)

## Computing \eqn{\hat{\Gamma}^\infty}

calc_GammaINF(e = e, L = 2)

## Computing \eqn{L_{And}}

calc_L_And(e = e)
sapply(c("yule-walker", "burg", "ols", "mle", "yw"),
       function(m) calc_L_And(e = e, AR.method = m)) ## comparing AR.methods

## Computing \eqn{D_t}

D <- calc_D(smoothed_obj = rho_obj)
head(D) # D matrix for the first six time points

## Computing \eqn{se(\hat{\rho}_t(h))}
# nb: takes a few seconds to run

run <- FALSE ## change to TRUE to run the example
if (in_pkgdown() || run) {

SE <- calc_SE(smoothed_obj = rho_obj, h = 50)
head(SE) # SE vector for the first six time points

}



[Package timevarcorr version 0.1.1 Index]