1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Portfolio Analysis in R

Exercise

Interpreting correlation

Now you will learn how to compute the correlation between bond returns and equity returns. Just like volatilities, these correlations are dynamic. Therefore you need to distinguish between a static analysis that calculates correlations over a complete sample and a dynamic analysis that calculates correlations over a rolling sample. This is a similar analysis as you did for the time-varying performance evaluation in terms of mean return and volatility.

In this exercise you will learn 3 new functions from the PerformanceAnalytics package: chart.Scatter(), chart.Correlation(), and chart.RollingCorrelation().

Instructions

100 XP
  • Plot the equity returns (returns_equities) against the bond returns (returns_bonds) using the function chart.Scatter() with the bond returns on the x-axis. Do you see a relation?
  • Compute the correlation between the variables returns_bonds and returns_equities using cor().
  • Merge returns_bonds, and returns_equities using merge(). Call this returns.
  • Compute and visualize the correlation again, using chart.Correlation() with returns as the argument.
  • Compute the rolling 24-month estimates of the bond-equity correlation using the function chart.RollingCorrelation().