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

Description Usage Arguments Value References See Also Examples

View source: R/findSigMu.R View source: R/findSigMu.R

Description

Find μ(W) and W, given σ(W) and CLA result.

Usage

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

Arguments

Sig0

numeric vector of σ(W) values.

result

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

covar

the same n x 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.

Value

a list with components

Mu

numeric vector of same length, say M, as Sig0.

weight

numeric n x M matrix of weights.

References

Master thesis, p.33

See Also

findSig, CLA, MS.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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)

CLA documentation built on Dec. 16, 2021, 5:07 p.m.

Related to findMu in CLA...