Learn R Programming

CLA (version 0.96-3)

findSig: Find sigma(W) and W, given mu(W) and CLA result

Description

Find \(\sigma(W)\) and \(W\), given \(\mu(W\)) and CLA result.

Usage

findSig(Mu0, result, covar, equal.tol)

Value

a list with components

Sig

numeric vector of same length, say \(M\), as Mu0.

weight

numeric \(n \times M\) matrix of weights.

Arguments

Mu0

numeric vector of \(\mu(W)\) values.

result

a list with components MS_weight and weights_set as resulting from CLA().

covar

the same \(n \times n\) covariance matrix (of asset returns) as the argument of CLA().

equal.tol

numeric tolerance to be used in all.equal(.., tolerance = equal.tol) in the check to see if the \(\mu\) of two neighbouring turning points are equal.

References

Master thesis, p.33

See Also

findMu, CLA, MS.

Examples

Run this code
data(muS.sp500)
## Full data taking too much time for example: Subset of n=21:
if(getRversion() >= "3.6") .Rk <- RNGversion("3.5.0") # for back compatibility & warning
set.seed(2018)
iS <- sample.int(length(muS.sp500$mu), 21)
if(getRversion() >= "3.6") do.call(RNGkind, as.list(.Rk)) # revert
cov21 <- muS.sp500$covar[iS, iS]
CLsp.21 <- CLA(muS.sp500$mu[iS], covar=cov21, lB=0, uB = 1/2)
CLsp.21 # 14 turning points
summary(tpM <- CLsp.21$MS_weights[,"Mu"])
str(m0 <- c(min(tpM),seq(0.00205, 0.00525, by = 0.00005), max(tpM)))
sig. <- findSig(m0, result=CLsp.21, covar=cov21)
str(sig.)
stopifnot(dim(sig.$weight) == c(21, length(m0)))
plot(sig.$Sig, m0, xlab=quote(sigma), ylab = quote(mu),
     type = "o", cex = 1/4)
points(CLsp.21$MS_weights, col = "tomato", cex = 1.5)
title("Efficient Frontier from CLA()")
mtext("findSig() to interpolate between turning points", side=3)

Run the code above in your browser using DataLab