maxSharpe: Maximum-Sharpe-Ratio/Tangency Portfolio

View source: R/portfolio.R

maxSharpeR Documentation

Maximum-Sharpe-Ratio/Tangency Portfolio

Description

Compute maximum Sharpe-ratio portfolios, subject to lower and upper bounds on weights.

Usage

maxSharpe(m, var, min.return,
          wmin = -Inf, wmax = Inf, method = "qp",
          groups = NULL, groups.wmin = NULL, groups.wmax = NULL)

Arguments

m

vector of expected (excess) returns.

var

the covariance matrix: a numeric (real), symmetric matrix

min.return

minimumm required return. This is a technical parameter, used only for QP.

wmin

numeric: a lower bound on weights. May also be a vector that holds specific bounds for each asset.

wmax

numeric: an upper bound on weights. May also be a vector that holds specific bounds for each asset.

method

character. Currently, only "qp" is supported.

groups

a list of group definitions

groups.wmin

a numeric vector

groups.wmax

a numeric vector

Details

The function uses solve.QP from package quadprog. Because of the algorithm that solve.QP uses, var has to be positive definit (i.e. must be of full rank).

Value

a numeric vector (the portfolio weights) with an attribute variance (the portfolio's variance)

Author(s)

Enrico Schumann

References

Gilli, M., Maringer, D. and Schumann, E. (2019) Numerical Methods and Optimization in Finance. 2nd edition. Elsevier. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/C2017-0-01621-X")}

Schumann, E. (2023) Financial Optimisation with R (NMOF Manual). http://enricoschumann.net/NMOF.htm#NMOFmanual

Schumann, E. (2012) Computing the global minimum-variance portfolio. http://enricoschumann.net/R/minvar.htm

See Also

minvar, mvPortfolio, mvFrontier

Examples

S <- var(R <- NMOF::randomReturns(3, 10, 0.03))
x <- solve(S, colMeans(R))
x/sum(x)
x <- coef(lm(rep(1, 10) ~ -1 + R))
unname(x/sum(x))

maxSharpe(m = colMeans(R), var = S)
maxSharpe(m = colMeans(R), var = S, wmin = 0, wmax = 1)

NMOF documentation built on Oct. 20, 2023, 9:07 a.m.