Learn R Programming

CLA (version 0.96-3)

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

Description

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

Usage

findMu(Sig0, result, covar, tol.unir = 1e-06, equal.tol = 1e-06)

Value

a list with components

Mu

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

weight

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

Arguments

Sig0

numeric vector of \(\sigma(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().

tol.unir

numeric tolerance passed to uniroot.

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

findSig, CLA, MS.

Examples

Run this code
data(muS.sp500)
## Full data taking too much time for example
if(getRversion() >= "3.6") .Rk <- RNGversion("3.5.0") # for back compatibility & warning
set.seed(2016)
iS <- sample.int(length(muS.sp500$mu), 17)
if(getRversion() >= "3.6") do.call(RNGkind, as.list(.Rk)) # revert
cov17 <- muS.sp500$covar[iS, iS]
CLsp.17 <- CLA(muS.sp500$mu[iS], covar=cov17, lB=0, uB = 1/2)
CLsp.17 # 16 turning points
summary(tpS <- CLsp.17$MS_weights[,"Sig"])
str(s0 <- seq(0.0186, 0.0477, by = 0.0001))
mu.. <- findMu(s0, result=CLsp.17, covar=cov17)
str(mu..)
stopifnot(dim(mu..$weight) == c(17, length(s0)))
plot(s0, mu..$Mu, xlab=quote(sigma), ylab = quote(mu),
     type = "o", cex = 1/4)
points(CLsp.17$MS_weights, col = "tomato", cex = 1.5)

Run the code above in your browser using DataLab