Exercise

Visualizing risk factor correlation

Investment banks heavily invested in mortgage-backed securities (MBS) before and during the financial crisis. This makes MBS a likely risk factor for the investment bank portfolio. You'll assess this using scatterplots between portfolio returns and an MBS risk measure, the 90-day mortgage delinquency rate mort_del.

mort_del is only available as quarterly data. So portfolio_returns first needs to be transformed from daily to quarterly frequency using the DataFrame .resample() method.

Your workspace contains both portfolio_returns for an equal-weighted portfolio and the delinquency rate mort_del variable. For the scatterplots, plot_average and plot_min are plot axes in your workspace--you'll add your scatterplots to them using the .scatter() method.

Instructions

100 XP
  • Transform the daily portfolio_returns data into average quarterly data using the .resample() and .mean() methods.
  • Add a scatterplot between mort_del and portfolio_q_average to plot_average. Is there a strong correlation?
  • Now create minimum quarterly data using .min() instead of .mean().
  • Add a scatterplot between mort_del and portfolio_q_min to plot_min.