Get startedGet started for free

Visualize results

Now that we have run the optimization, we would like to take a look at the output and results. Recall that the optimization output is in a variable named opt. In our case, for the portfolio optimization in the previous exercise, we are interested in the optimal weights and estimated objective value. The weights are considered optimal in the sense that the set of weights minimizes the objective value, portfolio standard deviation, and satisfies the full investment and long only constraints based on historical data.

Note that you won't recognize some of these functions right now. Don't worry! They will all be introduced throughout the course.

This exercise is part of the course

Intermediate Portfolio Analysis in R

View Course

Exercise instructions

  • Print the output of the optimization from the previous problem. The output is stored in a variable named opt.
  • Extract the optimal weights with extractWeights().
  • Chart the optimal weights with chart.Weights().

Hands-on interactive exercise

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

# Print the results of the optimization


# Extract the optimal weights


# Chart the optimal weights

Edit and Run Code