Get Started

Excess returns

In order to perform a robust analysis on your portfolio returns, you must first subtract the risk-free rate of return from your portfolio returns. The portfolio return minus the risk-free rate of return is known as the Excess Portfolio Return.

In the United States, the risk-free rate has been close to 0 since the financial crisis (2008), but this step is crucial for other countries with higher risk-free rates such as Venezuela or Brazil.

The FamaFrenchData DataFrame is available in your workspace and contains the proper data for this exercise. The portfolio you will be working with is the equal-weighted portfolio from Chapter 2.

This is a part of the course

“Introduction to Portfolio Risk Management in Python”

View Course

Exercise instructions

  • Calculate excess portfolio returns by subtracting the risk free ('RF') column from the 'Portfolio' column in FamaFrenchData.
  • Review the plot of returns and excessive returns.

Hands-on interactive exercise

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

# Calculate excess portfolio returns
FamaFrenchData['Portfolio_Excess'] = ____

# Plot returns vs excess returns
CumulativeReturns = ((1+FamaFrenchData[['Portfolio','Portfolio_Excess']]).cumprod()-1)
CumulativeReturns.plot()
plt.show()

This exercise is part of the course

Introduction to Portfolio Risk Management in Python

IntermediateSkill Level
4.5+
11 reviews

Evaluate portfolio risk and returns, construct market-cap weighted equity portfolios and learn how to forecast and hedge market risk via scenario generation.

Learn about the main factors that influence the returns of your portfolios and how to quantify your portfolio's exposure to these factors.

Exercise 1: The Capital Asset Pricing modelExercise 2: Excess returns
Exercise 3: Calculating beta using co-varianceExercise 4: Calculating beta with CAPMExercise 5: Adjusted R-squaredExercise 6: Alpha and multi-factor modelsExercise 7: The Fama French 3-factor modelExercise 8: p-values and coefficientsExercise 9: Economic intuition in factor modelingExercise 10: The efficient market and alphaExercise 11: Expanding the 3-factor modelExercise 12: The 5-factor modelExercise 13: Alpha vs R-squared

What is DataCamp?

Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.

Start Learning for Free