Get startedGet started for free

Tangency Portfolio

The tangency portfolio is the portfolio on the efficient frontier with the highest Sharpe ratio. In this exercise you will calculate the composition of the tangency portfolio, taking into account investment options in Boeing and Microsoft stock. To do this, you will make use of the tangency.portfolio() function.

More specifically, tangency.portfolio() has the arguments:

  • er: the expected returns (mu_hat_annual)
  • cov.mat: the covariance matrix of the returns (cov_mat_annual)
  • risk.free: the risk-free rate (3% in this case).

This exercise is part of the course

Intro to Computational Finance with R

View Course

Exercise instructions

  • Assign the tangency portfolio to tangency_portfolio and print the result.
  • Study the summary of tangency_portfolio. Take into account a risk-free rate of 3%.
  • Make a plot with the plot() function that shows the weight of Boeing and Microsoft in the tangency portfolio.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# All data and CER parameters are preloaded in your workspace.
# Type ls() in the console to see them.

# The tangency portfolio
tangency_portfolio <-

# Print out tangency portfolio
tangency_portfolio

# Summary of tangency_portfolio with annual risk free rate of 3%


# Portfolio weights Boeing and Microsoft
Edit and Run Code