Session Ready
Exercise

Exploring risk-factor time series: equity indexes

In this exercise, you will look at an equity index and plot it for a particular range of dates. The data used in this exercise and in the rest of the course are contained in the package qrmdata. You also need the package xts to manipulate time series.

When the qrmdata library is attached, as it will be throughout the course, you can load a dataset with the data() command. For example, the command data("FTSE") loads the UK FTSE (Financial Times Stock Exchange) index, which you can then refer to as object FTSE.

If you want to extract the data from a certain date range, for example from April 1 to June 30, 2000, you can create a new object using the command ftse00 <- FTSE["2000-04-01/2000-06-30"].

From now onwards, the xts package will also already be loaded into your workspace.

This course touches on a lot of concepts you may have forgotten, so if you ever need a quick refresher, download the xts in R Cheat Sheet and keep it handy!

Instructions
100 XP
  • Load the Dow Jones index "DJ" from qrmdata.
  • Show the first and last few lines of the DJ index with head() and tail().
  • Plot the DJ index using plot().
  • Extract the DJ index for the crisis period 2008-2009 and assign to object dj0809.
  • Plot the dj0809 using the same plotting function as above.