globalMin.portfolio: Compute global minimum variance portfolio

Description Usage Arguments Details Value Author(s) Examples

View source: R/globalMin.portfolio.R

Description

Compute global minimum variance portfolio given expected return vector and covariance matrix. The portfolio can allow all assets to be shorted or not allow any assets to be shorted. The returned object is of class portfolio.

Usage

1
globalMin.portfolio(er, cov.mat, shorts = TRUE)

Arguments

er

N x 1 vector of expected returns

cov.mat

N x N return covariance matrix

shorts

logical, if TRUE then short sales (negative portfolio weights) are allowed. If FALSE then no asset is allowed to be sold short.

Details

The global minimum variance portfolio m allowing for short sales solves the optimization problem: min t(m)Σ m s.t. t(m)1=1 for which there is an analytic solution using matrix algebra. If short sales are not allowed then the portfolio is computed numerically using the function solve.QP() from the quadprog package.

Value

call

captures function call

er

portfolio expected return

sd

portfolio standard deviation

weights

N x 1 vector of portfolio weights

Author(s)

Eric Zivot

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
# construct the data
asset.names = c("MSFT", "NORD", "SBUX")
er = c(0.0427, 0.0015, 0.0285)
names(er) = asset.names
covmat = matrix(c(0.0100, 0.0018, 0.0011,
                  0.0018, 0.0109, 0.0026,
                  0.0011, 0.0026, 0.0199),
                nrow=3, ncol=3)
r.free = 0.005
dimnames(covmat) = list(asset.names, asset.names)

# compute global minimum variance portfolio
gmin.port = globalMin.portfolio(er, covmat)
attributes(gmin.port)
print(gmin.port)
summary(gmin.port, risk.free=r.free)
plot(gmin.port, col="blue")

# compute global minimum variance portfolio with no short sales
gmin.port.ns = globalMin.portfolio(er, covmat, shorts=FALSE)
attributes(gmin.port.ns)
print(gmin.port.ns)
summary(gmin.port.ns, risk.free=r.free)
plot(gmin.port.ns, col="blue")

IntroCompFinR documentation built on May 2, 2019, 4:46 p.m.