This module directly applies the frontier functions on a return series without creating the moments first. Please refer to the moment estimation module if you want to create a moment object first.

This module plots not only the mean-variance frontier but also the mean-ES frontier with relevant settings.

Portfolio optimisation based on variance

  1. Find the possible expected return range under the asset pool;

  2. Based on this range, list a sequence of expected returns ranging from the minimum to the maximum as the target returns of 100 portfolios;

  3. Get the optimised weights by targeting one expected return.

    • The optimisation uses the quadprog package.

    • It requires the mean vector, covariance matrix, constraint list, and the target rate. If you are not calculating the minimum variance portfolio, you do not need the mean vector or target rate.

    • A special portfolio called the tangency portfolio uses the method of maximising the Sharpe-ratio^2 value with the solver ipoptr.

Portfolio optimisation based on expected shortfall (ES)

This involves similar steps as the variance optimisation, but with a different optimisation function.

  • The solver here uses the package rglpk.


The user can set up constraints on each asset.

  • Short-sale constraints: this selection adds constraints for all assets to ensure that their weights are larger than 0.

  • Add constraints: the user can add specific constraints to be ">=" (larger or equal to), "<=" (less or equal to), or "==" (exactly equal to) certain weights. This can apply to both single assets or the sum of a group of assets (by selecting multiple assets together).

Special portfolios

This shows what portfolios or assets the user is interested in plotting on the graph.

Further sections

After selecting one portfolio on the efficient frontier, it will show a few sections at the bottom of the page.

  • Info: the user can use the "Save selected mean-variance portfolio returns" button to save the selected portfolio for other modules.

  • Weights: shows the asset weight allocation of the selected portfolio.

  • Historical returns: plots the historical return distribution of the selected portfolio in the sample period.

  • Risk contributions: shows the bar plot of each asset's contribution to the portfolio's risk in both variance and expected shortfall.

Last updated