# Aggregation matrix for Z = X + Y
A <- t(c(1,1))
# (10 x 3) in-sample residuals matrix (simulated)
res <- t(matrix(rnorm(n = 30), nrow = 3))
cov1 <- cscov("ols", n = 3) # OLS methods
cov2 <- cscov("str", agg_mat = A) # STR methods
cov3 <- cscov("wls", res = res) # WLS methods
cov4 <- cscov("shr", res = res) # SHR methods
cov5 <- cscov("sam", res = res) # SAM methods
# Custom covariance matrix
cscov.ols2 <- function(comb, x) diag(x)
cscov(comb = "ols2", x = 3) # == cscov("ols", n = 3)
Run the code above in your browser using DataLab