4. Cumulative simple returns. In the previous exercise, you computed the simple returns at a monthly frequency for the S&P500 index. We stored this
as a vector named sp500_simple_returns
, which has been defined for you in this exercise.
You now want to compute cumulative simple returns, starting at period 1 and extending to each period, t, in the same. Recall that you can compute them between periods 0 and t using the following expression:
In R
, the cumprod()
function can be used to compute the cumulative product for every observation in the sample.