Exercise

# Get a feel for the data

The choice of investment matters even when the underlying risky assets are similar. As a first example, let us consider the stock price of the Coca Cola Company and the PepsiCo company from January 2003 until the end of August 2016.

The time series plot shows you the value evolution of one dollar invested in each company. As an exercise, plot the time series showing the relative value of an investment in the Coca Cola company, compared to the value of an investment in PepsiCo. To do this exercise, you can use the corresponding price series, available as the variables `ko`

and `pep`

in your workspace.

Three important packages that you will use in this course are the xts and zoo packages (these are popular when working with time series data), and the PerformanceAnalytics package.

Instructions

**100 XP**

- Define
`ko_pep`

as the ratio expressing the value of the share price of the Coca Cola company in terms of the share price of PepsiCo. - Use plot.zoo() to visualize the variation in this ratio over time. Note that when the value of the ratio is larger than 1, the performance of
`ko`

since January 2003 is higher than that of`pep`

. - As a reference line, use abline() to include a horizontal line at
`h=1`

. Note that where the value of the ratio is larger than one, the Coca Cola Company outperforms Pepsico and vice versa.