Get startedGet started for free

Out of sample performance evaluation

This example will illustrate how your returns can change based on the weighting created by an optimized portfolio. You will use the estimation portfolio (pf_estim) to evaluate the performance of your portfolio on the estimation sample of returns (returns_eval).

How severe is the optimality loss? Let's compare, for the portfolio weights in pf_estim, the performance you expected using the evaluation sample (returns_estim) with the actual return on the out-of-sample period (returns_eval).

pf_estim, returns_estim, and returns_eval are pre-loaded in your workspace.

This exercise is part of the course

Introduction to Portfolio Analysis in R

View Course

Exercise instructions

  • Calculate the returns of the portfolio with monthly rebalance weights pf_estim$pw on the estimation sample returns_estim. Call this returns_pf_estim.
  • Calculate the returns of the portfolio with monthly rebalance weights pf_estim$pw on the evaluation sample returns_eval. Call this returns_pf_eval.
  • Use the function table.AnnualizedReturns() on returns_pf_estim.
  • Use the function table.AnnualizedReturns() on returns_pf_eval. Compare the return, risk, and Sharpe ratio of these portfolios. The results from the pf_eval are what you may expect in a real performance.

Hands-on interactive exercise

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

# Create returns_pf_estim
returns_pf_estim <- Return.portfolio(___, pf_estim$pw, rebalance_on = "months")


# Create returns_pf_eval


# Print a table for your estimation portfolio


# Print a table for your evaluation portfolio
 
Edit and Run Code