Exercise

Plotting financial data with PerformanceAnalytics

The PerformanceAnalytics package implements a collection of econometric functions for performance and risk analysis. It contains - among other things - functionality to generate great plots of financial time series. You will use some of that functionality in this exercise. Find an overview of the plotting functionality in the package here.

The chart.TimeSeries function generates a line plot of (multiple) return series, which allows you to assess the volatility of different assets, for example. While this is nice, charts generated by chart.TimeSeries could be hard to read when you evaluate the returns. The PerformanceAnalytics() function chart.Bar makes it easier to compare the returns of different assets on the same plot. Click 'Submit Answer' and use the arrows to compare the two plots. With all assets on the same scale, you see the lower volatility for the bond fund and the higher volatility for SBUX very clearly.

Lastly, have a look at the chart.CumReturns function which creates a cumulative return plot. It allows you to assess how a $1 investment in each asset evolved over time.

Instructions

100 XP
  • Generate a cumulative return plot with the chart.CumReturns function. Make sure that you understand how the simple returns are calculated and use them as input of the function. Furthermore, set the wealth.index argument to TRUE to show the future value of the $1 invested in the assets. To finish things up, show the legend in the left top and add the title Future Value of $1 invested to the plot.