| sm_vcov | R Documentation | 
Computes the variance covariance matrix of sample mean and second moment.
sm_vcov(X,vcov.func=vcov,fit.intercept=TRUE)
| X | an  | 
| vcov.func | a function which takes an object of class  | 
| fit.intercept | a boolean controlling whether we add a column of ones to the data, or fit the raw uncentered second moment. | 
Given p-vector x, the 'unified' sample is the 
p(p+3)/2 vector of x stacked on top 
of \mbox{vech}(x x^{\top}). 
Given n contemporaneous observations of p-vectors,
stacked as rows in the n \times p matrix X,
this function computes the mean and the variance-covariance
matrix of the 'unified' sample. 
One may use the default method for computing covariance,
via the vcov function, or via a 'fancy' estimator,
like sandwich:vcovHAC, sandwich:vcovHC, etc.
a list containing the following components:
| mu | a  | 
| Ohat | the  | 
| n | the number of rows in  | 
| p | the number of assets. | 
This function will be deprecated in future releases of this package. Users should migrate at that time to a similar function in the MarkowitzR package.
Steven E. Pav shabbychef@gmail.com
Pav, S. E. "Asymptotic Distribution of the Markowitz Portfolio." 2013 https://arxiv.org/abs/1312.0557
ism_vcov, sr_vcov
X <- matrix(rnorm(1000*3),ncol=3)
Sigmas <- sm_vcov(X)
Sigmas.n <- sm_vcov(X,vcov.func="normal")
Sigmas.n <- sm_vcov(X,fit.intercept=FALSE)
# make it fat tailed:
X <- matrix(rt(1000*3,df=5),ncol=3)
Sigmas <- sm_vcov(X)
if (require(sandwich)) {
 Sigmas <- sm_vcov(X,vcov.func=vcovHC)
}
# add some autocorrelation to X
Xf <- filter(X,c(0.2),"recursive")
colnames(Xf) <- colnames(X)
Sigmas <- sm_vcov(Xf)
if (require(sandwich)) {
Sigmas <- sm_vcov(Xf,vcov.func=vcovHAC)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.