sm_vcov: Compute variance covariance of 'Unified' Second Moment

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/unified.r

Description

Computes the variance covariance matrix of sample mean and second moment.

Usage

1
sm_vcov(X,vcov.func=vcov,fit.intercept=TRUE)

Arguments

X

an n x p matrix of observed returns.

vcov.func

a function which takes an object of class lm, and computes a variance-covariance matrix. If equal to the string "normal", we assume multivariate normal returns.

fit.intercept

a boolean controlling whether we add a column of ones to the data, or fit the raw uncentered second moment.

Details

Given p-vector x, the 'unified' sample is the p(p+3)/2 vector of x stacked on top of vech(x x'). Given n contemporaneous observations of p-vectors, stacked as rows in the n x 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.

Value

a list containing the following components:

mu

a q = p(p+3)/2 vector of the mean, then the vech'd second moment of the sample data

Ohat

the q x q estimated variance covariance matrix. Only the informative part is returned: one may assume a row and column of zeros in the upper left.

n

the number of rows in X.

p

the number of assets.

Note

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.

Author(s)

Steven E. Pav [email protected]

References

Pav, S. E. "Asymptotic Distribution of the Markowitz Portfolio." 2013 http://arxiv.org/abs/1312.0557

See Also

ism_vcov, sr_vcov

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
## Not run: 
if (require(sandwich)) {
 Sigmas <- sm_vcov(X,vcov.func=vcovHC)
}

## End(Not run)
# add some autocorrelation to X
Xf <- filter(X,c(0.2),"recursive")
colnames(Xf) <- colnames(X)
Sigmas <- sm_vcov(Xf)
## Not run: 
if (require(sandwich)) {
Sigmas <- sm_vcov(Xf,vcov.func=vcovHAC)
}

## End(Not run)

SharpeR documentation built on Oct. 8, 2018, 1:05 a.m.