Asset prices vs. asset returns
The goal of investing is to make a profit. The revenue or loss from investing depends on the amount invested and changes in prices, and high revenue relative to the size of an investment is of central interest. This is what financial asset returns measure, changes in price as a fraction of the initial price over a given time horizon, for example, one business day.
Let's again consider the eu_stocks
dataset. This dataset reports index values, which we can regard as prices. The indices are not investable assets themselves, but there are many investable financial assets that closely track major market indices, including mutual funds and exchange traded funds.
Log returns, also called continuously compounded returns, are also commonly used in financial time series analysis. They are the log of gross returns, or equivalently, the changes (or first differences) in the logarithm of prices.
The change in appearance between daily prices and daily returns is typically substantial, while the difference between daily returns and log returns is usually small. As you'll see later, one advantage of using log returns is that calculating multi-period returns from individual periods is greatly simplified - you just add them together!
In this exercise, you'll further explore the eu_stocks
dataset, including plotting prices, converting prices to (net) returns, and converting prices to log returns.
This exercise is part of the course
Time Series Analysis in R
Exercise instructions
- Use
plot()
to generate a plot of theeu_stocks
data. - Use the pre-written code to convert daily prices in the
eu_stocks
data to daily netreturns
. - Use
ts()
to convertreturns
to ats
object. Set thestart
argument equal toc(1991, 130)
and set thefrequency
argument equal to260
. - Use another call to
plot()
to view daily net returns. - Use the pre-written code combining
diff()
andlog()
to generatelogreturns
. - Use a final call to
plot()
to view daily log returns.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Plot eu_stocks
# Use this code to convert prices to returns
returns <- eu_stocks[-1,] / eu_stocks[-1860,] - 1
# Convert returns to ts
returns <- ts(___, start = c(___, ___), frequency = ___)
# Plot returns
# Use this code to convert prices to log returns
logreturns <- diff(log(eu_stocks))
# Plot logreturns