Learn R Programming

CLA (version 0.90-0)

CLA: Critical Line Algorithm

Description

The Critical Line Algorithm was first proposed by Markowitz to solve the mean-variance optimal portfolio problem.

... TODO: write more; give references (below) ...

Usage

CLA(mu, covar, lB, uB, tol.lambda = 1e-07, give.MS = TRUE, keep.names = TRUE)

Arguments

mu

numeric vector of length n containing the expected return \(E[R_i]\) for \(1=1,2,\dots,n\).

covar

the \(n \times n\) covariance matrix of the returns, must be positive definite.

lB, uB

vectors of length n with lower and upper bounds for the asset weights.

tol.lambda

the tolerance when checking for lambda changes or being zero.

give.MS

logical indicating if MS() should be computed (and returned) as well.

keep.names

logical indicating if the weights_set matrix should keep the (asset) names(mu).

Value

a list with components

weights_set

...

free_indices

...

gammas

...

lambdas

....

MS_weights

the \(\mu(W)\) and \(\sigma(W)\) corresponding to the asset weights weights_set, i.e., simply the same as MS(weights_set = weights_set, mu = mu, covar = covar).

References

TODO

See Also

MS.

Examples

Run this code
# NOT RUN {
data(muS.sp500)
## Full data taking too much time for example
set.seed(47)
iS <- sample.int(length(muS.sp500$mu), 24)

CLsp.24 <- CLA(muS.sp500$mu[iS], muS.sp500$covar[iS, iS], lB=0, uB=1/10)
CLsp.24 # using the print() method for class "CLA"

if(require(Matrix)) { ## visualize how weights change "along turning points"
  show(image(Matrix(CLsp.24$weights_set, sparse=TRUE),
             main = "CLA(muS.sp500 <random_sample(size=24)>) $ weights_set",
             xlab = "turning point", ylab = "asset number"))
}

# }

Run the code above in your browser using DataLab