X <- matrix(rnorm(1000*3),ncol=3)
colnames(X) <- c("ABC","XYZ","WORM")
Sigmas <- sr_vcov(X)
# make it fat tailed:
X <- matrix(rt(1000*3,df=5),ncol=3)
Sigmas <- sr_vcov(X)
# \donttest{
if (require(sandwich)) {
Sigmas <- sr_vcov(X,vcov.func=vcovHC)
}
# }
# add some autocorrelation to X
Xf <- filter(X,c(0.2),"recursive")
colnames(Xf) <- colnames(X)
Sigmas <- sr_vcov(Xf)
# \donttest{
if (require(sandwich)) {
Sigmas <- sr_vcov(Xf,vcov.func=vcovHAC)
}
# }
# should run for a vector as well
X <- rnorm(1000)
SS <- sr_vcov(X)
Run the code above in your browser using DataLab