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
}
Run the code above in your browser using DataLab