Exercise

# The xyplot() method for time series objects

By making use of the object-oriented programming facilities supported by R, high-level `lattice`

functions can be extended to support data structures other than data frames. A common example of such data structures is provided by time series objects. The `xyplot()`

function has a suitable method for time series objects. Your goal in this exercise is to use it to create a time series plot of the built-in `EuStockMarkets`

dataset, which gives daily closing prices of four major European stock indices.

The function to create the time-series plot is simply

`xyplot()`

.Instead of a formula and a data frame, the only mandatory argument is a time series object, which must be the first argument.

The main features of this method are:

The default value of

`type`

is`"l"`

, so that data points are joined by lines.The argument

`superpose`

, which can take values`TRUE`

or`FALSE`

, is used to control whether multiple time series are plotted within the same panel or in separate panels, respectively. The default is to plot them separately.The argument

`cut`

, which should be a list of the form`list(number = , overlap = )`

, is used to produce so-called "cut-and-stack" plots, by splitting the time axis into multiple overlapping periods which are then used to condition. This makes it easier to see parts of a long series.

Instructions

**100 XP**

- Create a time series plot of EU stock market data.
- The first argument is the time series,
`EuStockMarkets`

, not a formula. - Instead of plotting the four series on separate panels, use the
`superpose`

argument to plot them together. - Cut the series into three parts, with an overlap of
`0.25`

between successive parts.

- The first argument is the time series,