ComeçarComece de graça

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.

Este exercício faz parte do curso

Introduction to Portfolio Analysis in R

Ver curso

Instruções do exercício

  • 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().

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# 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()
Editar e executar o código