Get startedGet started for free

The efficient frontier

Using the fact that all efficient portfolios can be written as a convex combination of two efficient portfolios, you can compute efficient portfolios as convex combinations of the global minimum variance portfolio and the efficient portfolio calculated in the previous exercise:

$$ z = \alpha *m + (1-\alpha)*x $$

for values of \(\alpha\) being between \(-1\) and \(1\), with \(m\) the vector of portfolio weights of the global minimum variance portfolio and with \(x\) the vector of portfolio weights of the efficient portfolio that was calculated in the previous exercise.

This exercise is part of the course

Intro to Computational Finance with R

View Course

Exercise instructions

Run the code. It uses the efficient.frontier() function to calculate the expected returns and standard deviation of the portfolios lying on the curve. Afterwards, it makes a plot of the efficient frontier curve via plot(). Set the colors of the dots to blue, the lwd argument to 2, and make sure that the stock names are displayed.

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 efficient frontier of risky assets
efficient_frontier <- efficient.frontier(mu_hat_month, cov_mat_month, alpha.min = -1, alpha.max = 1)

# Generate summary
summary(efficient_frontier)

# Plot
plot(efficient_frontier, plot.assets = TRUE, col = "blue", lwd = 2)
Edit and Run Code