Compute mean--variance efficient portfolios and efficient frontiers.
mvFrontier(m, var, wmin =0, wmax =1, n =50, rf =NA, groups =NULL, groups.wmin =NULL, groups.wmax =NULL)mvPortfolio(m, var, min.return, wmin =0, wmax =1, lambda =NULL, groups =NULL, groups.wmin =NULL, groups.wmax =NULL)
Arguments
m: vector of expected returns
var: expected variance--covariance matrix
wmin: numeric: minimum weights
wmax: numeric: maximum weights
n: number of points on the efficient frontier
min.return: minimal required return
rf: risk-free rate
lambda: risk--reward trade-off
groups: a list of group definitions
groups.wmin: a numeric vector
groups.wmax: a numeric vector
Details
mvPortfolio computes a single mean--variance efficient portfolio, using package quadprog. It does so by minimising portfolio variance, subject to constraints on minimum return and budget (weights need to sum to one), and min/max constraints on the weights.
which may be more convenient (e.g. for setting \codelambda1 to 1).
mvFrontier computes returns, volatilities and compositions for portfolios along an efficient frontier. If rf is not NA, cash is included as an asset.
Returns
For mvPortfolio, a numeric vector of weights.
For mvFrontier, a list of three components:
return: returns of portfolios
volatility: volatilities of portfolios
weights: A matrix of portfolio weights. Each column holds the weights for one portfolio on the frontier. If rf is specified, an additional row is added, providing the cash weight.
The i-th portfolio on the frontier corresponds to the i-th elements of return and volatility, and the i-th column of portfolio.
References
Gilli, M., Maringer, D. and Schumann, E. (2019) Numerical Methods and Optimization in Finance. 2nd edition. Elsevier. tools:::Rd_expr_doi("10.1016/C2017-0-01621-X")