Get startedGet started for free

Annualized mean and volatility

The mean and volatility of monthly returns correspond to the average and standard deviation over a monthly investment horizon. Investors annualize those statistics to show the performance over an annual investment horizon.

To do so, the package PerformanceAnalytics has the function Return.annualized() and StdDev.annualized() to compute the (geometrically) annualized mean return and annualized standard deviation for you.

Remember that the Sharpe ratio is found by taking the mean excess returns subtracted by the risk-free rate, and then divided by the volatility! The packages PerformanceAnalytics and sp500_returns are preloaded for you.

This exercise is part of the course

Introduction to Portfolio Analysis in R

View Course

Exercise instructions

  • Use the function Return.annualized() to compute the annualized mean of sp500_returns.
  • Use the function StdDev.annualized() to compute the annualized standard deviation of sp500_returns.
  • Calculate the annualized Sharpe Ratio using commands from the PerformanceAnalytics package, assign it to ann_sharpe. Assume the risk free rate is 0.
  • Obtain all the above results at once using the function table.AnnualizedReturns().

Hands-on interactive exercise

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

# Compute the annualized mean


# Compute the annualized standard deviation


# Compute the annualized Sharpe ratio: ann_sharpe
ann_sharpe <- 

# Compute all of the above at once using table.AnnualizedReturns()
Edit and Run Code