Chapter 1
Return Calculations
Updated: June 24, 2014
In this Chapter we cover asset return calculations with an emphasis onequity returns. Section 1.1 covers basic time value of money calculations.
Section 1.2 covers asset return calculations, including both simple and continuously compounded returns. Section 1.3 illustrates asset return calculations
using R.

1.1

The Time Value of Money

This section reviews basic time value of money calculations. The concepts offuture value, present value and the compounding of interest are defined anddiscussed.

1.1.1

Future value, present value and simple interest.

Consider an amount $ invested for  years at a simple interest rate of 
per annum (where  is expressed as a decimal). If compounding takes place
only at the end of the year the future value after  years is:  = $ (1 + ) × · · · × (1 + ) = $ · (1 + ) (1.1)

Over the first year, $ grows to $ (1+) = $ +$ × which represents theinitial principle $ plus the payment of simple interest $ ×  for the year.
Over the second year, the new principle $ (1+) grows to $ (1+)(1+) =$ (1 + )2  and so on.
1

2

CHAPTER 1 RETURN CALCULATIONS

Example 1 Future value with simple interest.
Consider putting $1000 in an interest checking account that pays a simple
annual percentage rate of 3% The future value after  = 1 5 and 10 years
is, respectively, 1 = $1000 · (103)1 = $1030
 5 = $1000 · (103)5 = $115927 10 = $1000 · (103)10 = $134392
Over the first year, $30 in interest is paid; over three years, $15927 in interestis accrued; over five years, $34392 in interest is accrued ¥The future value formula (1.1) defines a relationship between four variables:      and  Given three variables, the fourth variable can be
determined. Given     and  and solving for  gives the present value
formula:
 

(1.2)
 =
(1 + )
Given     and  the annual interest rate on the investment is defined
as:
µ
¶1
 
=
− 1
(1.3)

Finally, given     and  we can solve for  :=ln(   )
ln(1 + )(1.4)

The expression (1.4) can be used to determine the number years it takes
for an investment of $ to double. Setting   = 2 in (1.4) gives:
=

ln(2)
07
≈

ln(1 + )which uses the approximations ln(2) = 06931 ≈ 07 and ln(1 + ) ≈  for close to zero (see the Appendix). The approximation  ≈ 07 is called
the rule of 70.
Example 2 Using the rule of 70.

3

1.1 THE TIME VALUE OF MONEY

The table below summarizes the number of years it takes for an initial investment to double at diﬀerent simple interest rates.
ln(2) ln(1 + ) 07

0.01 69.66

70.00

0.02 35.00

35.00

0.03 23.45

23.33

0.04 17.67

17.50

0.05 14.21

14.00

0.06 11.90

11.67

0.07 10.24

10.00

0.08 9.01

8.75

0.09 8.04

7.77

0.10 7.28

7.00

¥

1.1.2

Multiple compounding periods.

If interest is paid  times per year then the future value after  years is:
µ
¶·



  = $ · 1 +is often referred to as the periodic interest rate. As , the frequency ofcompounding, increases the rate becomes continuously compounded and it
can be shown that future value becomes
¶·
µ


= $ · ·   = lim $ · 1 +→∞
where (·) is the exponential function and 1 = 271828
Example 3 Future value with diﬀerent compounding frequencies.

4

CHAPTER 1 RETURN CALCULATIONS

If the simple annual percentage rate is 10% then the value of $1000 at theend of one year ( = 1) for diﬀerent values of  is given in the table below.
Compounding Frequency Value of $1000 at end of 1 year ( = 10%)Annually ( = 1)

1100

Quarterly ( = 4)1103.8

Weekly ( = 52)1105.1

Daily ( = 365)1105.515

Continuously ( = ∞)1105.517¥
The continuously compounded analogues to the present value, annual
return and horizon period formulas (1.2), (1.3) and (1.4) are:
 = −   
µ
¶
1
 
 = ln



µ
¶
 
1
ln

 =



1.1.3

Eﬀective annual rate

We now consider the relationship between simple interest rates, periodic
rates, eﬀective annual rates and continuously compounded rates. Suppose
an investment pays a periodic interest rate of 2% each quarter. This gives
rise to a simple annual rate of 8% (2% ×4 quarters) At the end of the year,$1000 invested accrues to
µ
¶4·1
008
$1000 · 1 += $108240
4The eﬀective annual rate,   on the investment is determined by the relationship$1000 · (1 +  ) = $108240

5

1.1 THE TIME VALUE OF MONEY
Solving for  gives =$108240− 1 = 00824
$1000

or  = 824% Here, the eﬀective annual rate is the simple interest ratewith annual compounding that gives the same future value that occurs withsimple interest compounded four times per year. The eﬀective annual rateis greater than the simple annual rate due to the payment of interest on
interest.
The general relationship between the simple annual rate  with payments
 time per year and the eﬀective annual rate,   is¶µ
(1 +  ) = 1 +Given the simple rate  we can solve for the eﬀective annual rate using¶µ
 = 1 +
− 1


(1.5)

Given the eﬀective annual rate   we can solve for the simple rate using¤£ =  (1 +  )1 − 1 

The relationship between the eﬀective annual rate and the simple ratethat is compounded continuously is(1 +  ) =  
Hence,
 =  − 1
 = ln(1 +  )

Example 4 Determine eﬀective annual rates.

6

CHAPTER 1 RETURN CALCULATIONSThe eﬀective annual rates associated with the investments in Example 2 aregiven in the table below:
Compounding Frequency Value of $1000 at end of 1 year ( = 10%)

Annually ( = 1)

1100

10%

Quarterly ( = 4)1103.81038%

Weekly ( = 52)1105.11051%

Daily ( = 365)1105.515

1055%

Continuously ( = ∞)¥1105.5171055%

Example 5 Determine continuously compounded rate from eﬀective annual
rate
Suppose an investment pays a periodic interest rate of 5% every six months( = 2 2 = 005). In the market this would be quoted as having an annual
percentage rate,   of 10%. An investment of $100 yields $100 · (105)2 =$11025 after one year. The eﬀective annual rate,   is then 1025% To findthe continuously compounded simple rate that gives the same future value
as investing at the eﬀective annual rate we solve = ln(11025) = 009758
That is, if interest is compounded continuously at a simple annual rate of
9758% then $100 invested today would grow to $100 · 009758 = $11025 ¥1.2

Asset Return Calculations

In this section, we review asset return calculations given initial and future
prices associated with an investment. We first cover simple return calculations, which are typically reported in practice but are often not convenient for
statistical modeling purposes. We then describe continuously compounded
return calculations, which are more convenient for statistical modeling purposes.

1.2 ASSET RETURN CALCULATIONS

1.2.1

7

Simple Returns

Consider purchasing an asset (e.g., stock, bond, ETF, mutual fund, option,etc.) at time 0 for the price 0  and then selling the asset at time 1 for the
price 1  If there are no intermediate cash flows (e.g., dividends) between 0and 1  the rate of return over the period 0 to 1 is the percentage change inprice:
 − 0
(1.6)
(0  1 ) = 1
0
The time between 0 and 1 is called the holding period and (1.6) is called theholding period return. In principle, the holding period can be any amountof time: one second; five minutes; eight hours; two days, six minutes, andtwo seconds; fifteen years. To simply matters, in this chapter we will assume
that the holding period is some increment of calendar time; e.g., one day, onemonth or one year. In particular, we will assume a default holding period of
one month in what follows.
Let  denote the price at the end of month  of an asset that pays no
dividends and let −1 denote the price at the end of month  − 1. Then the
one-month simple net return on an investment in the asset between months
 − 1 and  is defined as = − −1= %∆ 
−1

(1.7)

−1

Writing −= −1− 1, we can define the simple gross return as−1

1 +  =



−1

(1.8)

The one-month gross return has the interpretation of the future value of $1
invested in the asset for one-month. Unless otherwise stated, when we refer toreturns we mean net returns. Since asset prices must always be non-negative(a long position in an asset is a limited liability investment), the smallest
value for  is −1 or −100%
Example 6 Simple return calculation.
Consider a one-month investment in Microsoft stock. Suppose you buy thestock in month  − 1 at −1 = $85 and sell the stock the next month for

8

CHAPTER 1 RETURN CALCULATIONS

 = $90 Further assume that Microsoft does not pay a dividend between
months  − 1 and  The one-month simple net and gross returns are then$90$90 − $85=
− 1 = 10588 − 1 = 00588
$85$85
1 +  = 10588
 =The one-month investment in Microsoft yielded a 588% per month return.
Alternatively, $1 invested in Microsoft stock in month  − 1 grew to $10588
in month  ¥Multi-period returns
The simple two-month return on an investment in an asset between months
 − 2 and  is defined as (2) = − −2

=
− 1
−2
−2



Writing −2= −1· −1
the two-month return can be expressed as:−2 −1·−1
−1 −2= (1 +  )(1 + −1 ) − 1 (2) =Then the simple two-month gross return becomes:
1 +  (2) = (1 +  )(1 + −1 ) = 1 + −1 +  + −1  
which is a product of the two simple one-month gross returns and not one
plus the sum of the two one-month returns. Hence, (2) = −1 +  + −1  
If, however, −1 and  are small then −1  ≈ 0 and 1 +  (2) ≈ 1 +−1 +  so that  (2) ≈ −1 +  
Adding two simple one-period returns to arrive at a two-period return
when one-period returns are large can lead to very misleading results. For
example, suppose that −1 = 05 and  = −05 Adding the two one-period
returns gives a two-period return of zero. However, the actual two-period

1.2 ASSET RETURN CALCULATIONS

9return is  (2) − 1 = (15)(05) − 1 = −025 This example highlights thefact that equal positive and negative percentage changes do not aﬀect wealthsymmetrically.
In general, the -month gross return is defined as the product of  onemonth gross returns:
1 +  () = (1 +  )(1 + −1 ) · · · (1 + −+1 )−1Y=(1 + − )

(1.9)

=0

Example 7 Computing two-period returns
Continuing with the previous example, suppose that the price of Microsoft
stock in month  − 2 is $80 and no dividend is paid between months  − 2and  The two-month net return is (2) =$90$90 − $80=
− 1 = 11250 − 1 = 01250
$80$80

or 12.50% per two months. The two one-month returns are$85 − $80
= 10625 − 1 = 00625
$80$90 − 85
= 10588 − 1 = 00588
 =
$85

−1 =and the geometric average of the two one-month gross returns is
1 +  (2) = 10625 × 10588 = 11250
¥Portfolio Returns
Consider an investment of $ in two assets, named asset A and asset B.
Let  denote the fraction or share of wealth invested in asset A, and let
 denote the remaining fraction invested in asset  The dollar amounts
invested in assets A and B are $ ×  and $ ×   respectively. We
assume that the investment shares add up to 1, so that  +  = 1 The
collection of investment shares (   ) defines a portfolio. For example, one

10

CHAPTER 1 RETURN CALCULATIONS

portfolio may be ( = 05  = 05) and another may be ( = 0  = 1)
Negative values for  or  represent short sales. Let  and  denotethe simple one-period returns on assets A and B We wish to determine thesimple one-period return on the portfolio defined by (   ) . To do this,note that at the end of period  the investments in assets A and B are worth$ ×  (1 +  ) and $ ×  (1 +  ) respectively. Hence, at the end of
period  the portfolio is worth$ × [ (1 +  ) +  (1 +  )] Hence,  (1 +  ) +  (1 +  ) defines the gross return on the portfolio.
The portfolio gross return is equal to a weighted average of the gross returns
on assets A and B where the weights are the portfolio shares  and  
To determine the portfolio rate of return , re-write the portfolio gross
return as
1 +  =  +  +   +   = 1 +   +   
since  +  = 1 by construction. Then the portfolio rate of return is =   +   
which is equal to a weighted average of the simple returns on assets A andB where the weights are the portfolio shares  and  
Example 8 Compute portfolio return
Consider a portfolio of Microsoft and Starbucks stock in which you initiallypurchase ten shares of each stock at the end of month  − 1 at the prices −1 = $85 and −1 = $30 respectively The initial value of theportfolio is −1 = 10 × $85 + 10 × 30 = $1 150 The portfolio shares are  = 8501150 = 07391 and  = 301150 = 02609 Suppose at theend of month    = $90 and  = $28 Assuming that Microsoft andStarbucks do not pay a dividend between periods  − 1 and  the one-period
returns on the two stocks are$90 − $85
= 00588
$85$28 − $30
 == −00667
$30  =1.2 ASSET RETURN CALCULATIONS

11

The one-month rate of return on the portfolio is then = (07391)(00588) + (02609)(−00667) = 002609
and the portfolio value at the end of month  is = −1 (1 +  ) = $1 100 × (102609) = $1 180¥
In general, for a portfolio of  assets with investment shares  such that
1 +· · ·+ = 1 the one-period portfolio gross and simple returns are definedas
1 +  = =


X
=1

X

 (1 +  )(1.10)

 

(1.11)

=1

Adjusting for dividends
If an asset pays a dividend,  , sometime between months  − 1 and , thetotal net return calculation becomes = +  − −1
 − −1

=
+

−1
−1
−1

(1.12)

−1
where −is referred as the capital gain and −1is referred to as the−1dividend yield. The total gross return is

1 +  = + 

−1(1.13)

The formula (1.9) for computing multiperiod return remains the same exceptthat one-period gross returns are computed using (1.13).
Example 9 Compute total return when dividends are paid
Consider a one-month investment in Microsoft stock. Suppose you buy thestock in month  − 1 at −1 = $85 and sell the stock the next month for12

CHAPTER 1 RETURN CALCULATIONS

 = $90 Further assume that Microsoft pays a $1 dividend between months
 − 1 and  The capital gain, dividend yield and total return are then$90 + $1 − $85$90 − $85
$1
=
+
$85
$85
$85
= 00588 + 00118= 00707

 =The one-month investment in Microsoft yields a 707% per month total return. The capital gain component is 588% and the dividend yield componentis 118% ¥Adjusting for Inflation
The return calculations considered so far are based on the nominal or current
prices of assets. Returns computed from nominal prices are nominal returns.
The real return on an asset over a particular horizon takes into account thegrowth rate of the general price level over the horizon. If the nominal priceof the asset grows faster than the general price level then the nominal return
will be greater than the inflation rate and the real return will be positive.
Conversely, if the nominal price of the asset increases less than the generalprice level then the nominal return will be less than the inflation rate andthe real return will be negative.
The computation of real returns on an asset is a two step process:• Deflate the nominal price of the asset by the general price level• Compute returns in the usual way using the deflated prices
To illustrate, consider computing the real simple one-period return on anasset. Let  denote the nominal price of the asset at time  and let  
denote an index of the general price level (e.g. consumer price index) at time
1  The deflated or real price at time  isReal =
1



 

The CPI is usually normalized to 1 or 100 in some base year. We assume that the
CPI is normalized to 1 in the base year for simplicity.

13

1.2 ASSET RETURN CALCULATIONS
and the real one-period return isReal

−1

Real
− 
Real − −1
 
−1
=
=
−1
Real
−1
 

(1.14)

−1  −1=·− 1
−1  
The one-period gross real return return is
1 + Real =  −1·−1  (1.15)

If we define inflation between periods  − 1 and  as =  −  −1= %∆   −1(1.16) 
and (1.14) may be re-expressed asthen 1 +   = −1Real =1 + 
− 1
1 + 

(1.17)

Example 10 Compute real return
Consider, again, a one-month investment in Microsoft stock. Suppose the
CPI in months  − 1 and  is 1 and 101 respectively, representing a 1%
monthly growth rate in the overall price level. The real prices of Microsoft
stock are
$85
$90
Real
−1
=
= $85 Real == $891089
1
101
and the real monthly return isReal =$8910891 − $85= 00483
$85

The nominal return and inflation over the month are =$90 − $85
101 − 1= 00588  == 001
$85
1Then the real return computed using (1.17) isReal =10588− 1 = 00483
101

14

CHAPTER 1 RETURN CALCULATIONS

Notice that simple real return is almost, but not quite, equal to the simple
nominal return minus the inflation rate:
Real ≈  −   = 00588 − 001 = 00488
¥Annualizing returns
Very often returns over diﬀerent horizons are annualized, i.e., converted toan annual return, to facilitate comparisons with other investments. The annualization process depends on the holding period of the investment and an
implicit assumption about compounding. We illustrate with several examples.
To start, if our investment horizon is one year then the annual gross andnet returns are just
1 +  = 1 +  (12) == (1 +  )(1 + −1 ) · · · (1 + −11 )
−12 =  (12)
In this case, no compounding is required to create an annual return.
Next, consider a one-month investment in an asset with return   Whatis the annualized return on this investment? If we assume that we receive thesame return  =  every month for the year, then the gross annual returnis
1 +  = 1 +  (12) = (1 + )12 
That is, the annual gross return is defined as the monthly return compoundedfor 12 months. The net annual return is then = (1 + )12 − 1
Example 11 Compute annualized return from one-month return
In the first example, the one-month return,   on Microsoft stock was 588%
If we assume that we can get this return for 12 months then the annualized
return is = (10588)12 − 1 = 19850 − 1 = 09850

or 9850% per year. Pretty good! ¥1.2 ASSET RETURN CALCULATIONS

15

Now, consider a two-month investment with return  (2) If we assume
that we receive the same two-month return (2) =  (2) for the next six
two-month periods, then the gross and net annual returns are
1 +  = (1 + (2))6 
 = (1 + (2))6 − 1
Here the annual gross return is defined as the two-month return compoundedfor 6 months.
Example 12 Compute annualized return from two-month return
Suppose the two-month return,  (2) on Microsoft stock is 125% If weassume that we can get this two-month return for the next 6 two-month
periods then the annualized return is = (11250)6 − 1 = 20273 − 1 = 10273
or 102.73% per year ¥Now suppose that our investment horizon is two years. That is, we start
our investment at time  − 24 and cash out at time  The two-year gross What is the annual return on this two-year
return is then 1 +  (24) = −24
investment? The process is the same as computing the eﬀective annual rate.
To determine the annual return we solve the following relationship for  :(1 +  )2 = 1 +  (24) =⇒ = (1 +  (24))12 − 1
In this case, the annual return is compounded twice to get the two-year
return and the relationship is then solved for the annual return.
Example 13 Compute annualized return from two-year return
Suppose that the price of Microsoft stock 24 months ago is −24 = $50 andthe price today is  = $90 The two-year gross return is 1 +  (24) = $90=$50
18000 which yields a two-year net return of  (24) = 080 = 80% The
annual return for this investment is defined as
 = (1800)12 − 1 = 13416 − 1 = 03416
or 3416% per year ¥16

CHAPTER 1 RETURN CALCULATIONS

1.2.2

Continuously Compounded Returns

In this section we define continuously compounded returns from simple returns, and describe their properties.
One-period Returns
Let  denote the simple monthly return on an investment. The continuously
compounded monthly return,   is defined as:¶µ(1.18)
 = ln(1 +  ) = ln−1where ln(·) is the natural log function2 . To see why  is called the continuously compounded return, take the exponential of both sides of (1.18) togive: = 1 +  =−1Rearranging we get = −1  
so that  is the continuously compounded growth rate in prices between
months  − 1 and . This is to be contrasted with   which is the simple
growth rate in prices between
months  − 1 and  without any compounding.
³ ´Furthermore, since ln  = ln() − ln() it follows that¶ = ln−1= ln( ) − ln(−1 )=  − −1 µ

where  = ln( ). Hence, the continuously compounded monthly return,  
can be computed simply by taking the first diﬀerence of the natural logarithms of monthly prices.
Example 14 Compute continuously compounded returns
2

The continuously compounded return is always defined since asset prices,   arealways non-negative. Properties of logarithms and exponentials are discussed in the appendix to this chapter.

1.2 ASSET RETURN CALCULATIONS

17

Using the price and return data from Example 1, the continuously compounded monthly return on Microsoft stock can be computed in two ways:
 = ln(10588) = 00571
 = ln(90) − ln(85) = 44998 − 44427 = 00571
Notice that  is slightly smaller than   Why?
Given a monthly continuously compounded return   is straightforward
to solve back for the corresponding simple net return  : =  − 1

(1.19)

Hence, nothing is lost by considering continuously compounded returns instead of simple returns. Continuously compounded returns are very similar
to simple returns as long as the return is relatively small, which it generally
will be for monthly or daily returns. Since  is bounded from below by −1
the smallest value for  is −∞ This, however, does not mean that you could
lose an infinite amount of money on an investment. The actual amount ofmoney lost is determined by the simple return (1.19).
For modeling and statistical purposes it is often much more convenient
to use continuously compounded returns due to the additivity property ofmultiperiod continuously compounded returns discussed in the next subsection.
Example 15 Determine simple return from continuously compounded return
In the previous example, the continuously compounded monthly return on
Microsoft stock is  = 571% The simple net return is then = 0571 − 1 = 00588
¥Multi-Period Returns
The relationship between multi-period continuously compounded returns andone-period continuously compounded returns is more simple than the relationship between multi-period simple returns and one-period simple returns.

18

CHAPTER 1 RETURN CALCULATIONS

To illustrate, consider the two-month continuously compounded return defined as:¶µ (2) = ln(1 +  (2)) = ln
=  − −2 
−2Taking exponentials of both sides shows that = −2  (2)so that  (2) is the continuously compounded growth rate of prices betweenmonths  − 2 and  Using −2= −1· −1and the fact that ln( · ) =−2ln() + ln() it follows that¶µ −1· (2) = ln−1 −2
¶
µ
¶
µ
−1

+ ln
= ln
−1
−2
=  + −1 Hence the continuously compounded two-month return is just the sum of
the two continuously compounded one-month returns. Recall, with simple
returns the two-month return is a multiplicative (geometric) sum of two onemonth returns.
Example 16 Compute two-month continuously compounded returns.
Using the data from Example 2, the continuously compounded two-month
return on Microsoft stock can be computed in two equivalent ways. The firstway uses the diﬀerence in the logs of  and −2 : (2) = ln(90) − ln(80) = 44998 − 43820 = 01178
The second way uses the sum of the two continuously compounded one-month
returns. Here  = ln(90) − ln(85) = 00571 and −1 = ln(85) − ln(80) =00607 so that (2) = 00571 + 00607 = 01178
Notice that  (2) = 01178   (2) = 01250 ¥The continuously compounded −month return is defined by¶µ () = ln(1 +  ()) = ln
=  − − 
−

19

1.2 ASSET RETURN CALCULATIONSUsing similar manipulations to the ones used for the continuously compounded two-month return, we can express the continuously compounded−month return as the sum of  continuously compounded monthly returns:
 () =−1X(1.20)

− 

=0

The additivity of continuously compounded returns to form multiperiod returns is an important property for statistical modeling purposes.
Portfolio Returns
The continuously compounded portfolio return is defined by (1.18), where is computed using the portfolio return (1.11). However, notice that = ln(1 +  ) = ln(1 +


X
=1

  ) 6=

X  (1.21)

=1

where  denotes the continuously
P compounded one-period return on asset
 If the portfolio return  = =1   is not too large then  ≈ otherwise,    
Example 17 Compute continuously compounded portfolio returns
Consider a portfolio of Microsoft and Starbucks stock with   = 025
 = 075   = 00588  = −00503 and  = −002302.
Using (1.21), the continuous compounded portfolio return is = ln(1 − 002302) = ln(0977) = −002329
Using   = ln(1 + 00588) = 00572 and  = ln(1 − 00503) =−005161 notice that    +   = −002442 6= ¥

20

CHAPTER 1 RETURN CALCULATIONS

Adjusting for Dividends
The continuously compounded one-period return adjusted for dividends isdefined by (1.18), where  is computed using (1.12)3 .
Example 18 Compute continuously compounded total return
From example 9, the total simple return using (1.12) is  = 00707 The
continuously compounded total return is then = ln(1 +  ) = ln(10707) = 00683
¥Adjusting for Inflation
Adjusting continuously compounded nominal returns for inflation is particularly simple. The continuously compounded one-period real return is definedas:(1.22)
Real = ln(1 + Real )
Using (1.15), it follows that¶µ  −1
Real

= ln
·
−1  ¶µ¶µ −1

+ ln
= ln
−1
 
= ln( ) − ln(−1 ) + ln( −1 ) − ln(  )= ln( ) − ln(−1 ) − (ln(  ) − ln( −1 ))=  −  (1.23)

where  = ln( ) − ln(−1 ) = ln(1 +  ) is the nominal continuously compounded one-period return and   = ln(  ) − ln( −1 ) = ln(1 +   )is the one-period continuously compounded growth rate in the general pricelevel (continuously compounded one-period inflation rate). Hence, the realcontinuously compounded return is simply the nominal continuously compounded return minus the the continuously compounded inflation rate.
3

Show formula from Campbell, Lo and MacKinlay.

1.2 ASSET RETURN CALCULATIONS

21

Example 19 Compute continuously compounded real return
From example 10, the nominal simple return is  = 00588, the monthly
inflation rate is   = 001 and the real simple return is Real = 00483
Using (1.22), the real continuously compounded return isReal = ln(1 + Real ) = ln(10483) = 0047
Equivalently, using (1.23) the real return may also be computed as
Real =  −   = ln(10588) − ln(101) = 0047
¥Annualizing Continuously Compounded Returns
Just as we annualized simple monthly returns, we can also annualize continuously compounded monthly returns. For example, if our investment horizon
is one year then the annual continuously compounded return is just the sumof the twelve monthly continuously compounded returns:
 =  (12) =  + −1 + · · · + −1111X=
− 
=0

The average continuously compounded monthly return is defined as:
1 X =− 
12 =011

Notice that
12 ·  =

11
X

−

=0

so that we may alternatively express  as = 12 ·  
That is, the continuously compounded annual return is twelve times theaverage of the continuously compounded monthly returns.

22

50

CHAPTER 1 RETURN CALCULATIONS

1020return

30

40

MSFT
SBUX

0

50

100

150

Index

Figure 1.1: Monthly adjusted closing prices on Microsoft and Starbucks stockover the period March, 1993 through March, 2008.
As another example, consider a one-month investment in an asset with
continuously compounded return   What is the continuously compoundedannual return on this investment? If we assume that we receive the same
return  =  every month for the year, then the annual continuously compounded return is just 12 times the monthly continuously compounded return: =  (12) = 12 · 

1.3

Return Calculations in R

This section discusses the calculation and manipulation of returns in R. We
first discuss the use of core R functions to compute returns. We then we
discuss some R packages that contain functions for return calculations.
The examples in this section are based on the monthly adjusted closing price data for Microsoft and Starbucks stock over the period March,
1993 through March, 2008, downloaded from finance.yahoo.com, in the files
msftPrices.csv and sbuxPrices.csv, respectively. These prices can beimported into data.frame objects in R using the function read.csv():> loadPath = "C:\\Users\\ezivot\\Documents\\FinBook\\Data\\"

1.3 RETURN CALCULATIONS IN R

23

> sbux.df = read.csv(file=paste(loadPath, "sbuxPrices.csv", sep=""),+
header=TRUE, stringsAsFactors=FALSE)> msft.df = read.csv(file=paste(loadPath, "msftPrices.csv", sep=""),+
header=TRUE, stringsAsFactors=FALSE)

1.3.1

Return Calculations Using Core R Functions

In the data.frame objects sbux.df and msft.df, the first column contains
the date information and the second column contains the adjusted closing
price data (adjusted for dividend and stock splits):> colnames(sbux.df)[1] "Date""Adj.Close"> head(sbux.df)
Date Adj.Close
1 3/31/1993
1.19
2 4/1/1993
1.21
3 5/3/1993
1.50
4 6/1/1993
1.53
5 7/1/1993
1.48
6 8/2/1993
1.52
Notice that the dates do not always match up with the last trading day ofthe month. Figure 1.1 shows the monthly prices of the two stocks createdusing> plot(msft.df$Adj.Close, type = "l", lty = "solid", lwd = 2,+
col = "blue", ylab = "return")> lines(sbux.df$Adj.Close, lty = "dotted", lwd = 2, col = "black")> legend(x = "topleft", legend=c("MSFT", "SBUX"), lwd = 2,+
lty = c("solid", "dotted"), col = c("blue", "black"))
In Figure 1.1 the x-axis, unfortunately, does not show the dates. We will see
later how better time series plots can be created.
To compute simple monthly returns use> n = nrow(sbux.df)> sbux.ret = sbux.df$Adj.Close[2:n]/sbux.df$Adj.Close[1:n-1] - 1> msft.ret = msft.df$Adj.Close[2:n]/msft.df$Adj.Close[1:n-1] - 1> head(cbind(sbux.ret, msft.ret))

24

CHAPTER 1 RETURN CALCULATIONS

sbux.ret msft.ret[1,] 0.01681 -0.07407[2,] 0.23967 0.08444[3,] 0.02000 -0.04918[4,] -0.03268 -0.15948[5,] 0.02703 0.01538[6,] 0.12500 0.09596
To compute continuously compounded returns use> sbux.ccret = log(1 + sbux.ret)> msft.ccret = log(1 + msft.ret)or, equivalently, use> sbux.ccret = log(sbux.df$Adj.Close[2:n]/sbux.df$Adj.Close[1:n-1])> sbux.ccret = log(sbux.df$Adj.Close[2:n]/sbux.df$Adj.Close[1:n-1])> head(cbind(sbux.ccret, msft.ccret))sbux.ccret msft.ccret[1,]0.01667-0.07696[2,]0.21484
0.08107[3,]0.01980-0.05043[4,]-0.03323-0.17374[5,]0.02667
0.01527[6,]
0.11778
0.09163

1.3.2

R Packages for Return Calculations

There are several R packages that contain functions for creating, manipulating and plotting returns. An up-to-date list of packages relevant for financeis given in the finance task view on the comprehensive R archive network(CRAN). This section briefly describes some of the functions in the PerformanceAnalytics, quantmod, zoo, and xts packages.
The PerformanceAnalytics package, written by Brian Peterson andPeter Carl, contains functions for performance and risk analysis of financial
portfolios. Table 1.1 summarizes the functions in the package for performing
return calculations and for plotting financial data.
The functions in PerformanceAnalytics work best with the financial data
being represented as zoo objects (see the zoo package for details). A zoo

1.3 RETURN CALCULATIONS IN R

25

Function

Description

CalculateReturns

Calculate returns from prices

Drawdowns

Find the drawdowns and drawdown levels

maxDrawdown

Calculate the maximum drawdown from peak

Return.annualized

Calculate an annualized return

Return.cummulative

Calculate a compounded cumulative return

Return.excess

Calculate returns in excess of a risk free rate

Return.Geltner

Calculate Geltner liquidity-adjusted return

Return.read

Read returns data with diﬀerent date formats

chart.CumReturns

Plot cumulative returns over time

chart.Drawdown

Plot drawdowns over time

chartRelativePerformance

Plot relative performance among multiple assets

chart.TimeSeries

Plot time series

charts.PerformanceSummary Combination of performance charts.
Table 1.1: PerformanceAnalytics return calculation and plotting functions

26

CHAPTER 1 RETURN CALCULATIONS

object is a rectangular data object with an associated time index. The timeindex can be any ordered object, but it is usually some object that represents
dates (e.g., Date, yearmon, yearqtr, POSIXct, timeDate) To convert thedata.frame objects msft.df and sbux.df to zoo objects use:
> library(zoo)> dates.sbux = as.yearmon(sbux.df$Date, format="%m/%d/%Y")> dates.msft = as.yearmon(msft.df$Date, format="%m/%d/%Y")> sbux.z = zoo(x=sbux.df$Adj.Close, order.by=dates.sbux)> msft.z = zoo(x=msft.df$Adj.Close, order.by=dates.msft)> class(sbux.z)[1] "zoo"> head(sbux.z)
Mar 1993 Apr 1993 May 1993 Jun 1993 Jul 1993 Aug 1993
1.19
1.21
1.50
1.53
1.48
1.52
For monthly time series the zoo "yearmon" class, which represents dates interms of the month and year, is the most convenient time index. For generaldaily time series, use the core R "Date" class as the time index.
There are several advantages of using "zoo" objects to represent a timeseries data. For extracting observations, "zoo" objects can be subsettedusing dates and the window() function:> sbux.z[as.yearmon(c("Mar 1993", "Mar 1994"))]
Mar 1993 Mar 1994
1.19
1.52
> window(sbux.z, start=as.yearmon("Mar 1993"), end=as.yearmon("Mar 1994"))
Mar 1993 Apr 1993 May 1993 Jun 1993 Jul 1993 Aug 1993 Sep 1993 Oct 1993
1.19
1.21
1.50
1.53
1.48
1.52
1.71
1.67
Nov 1993 Dec 1993 Jan 1994 Feb 1994 Mar 1994
1.39
1.39
1.50
1.45
1.52
Two or more "zoo" objects can be merged together and aligned to acommon date index:> sbuxMsft.z = merge(sbux.z, msft.z)> head(sbuxMsft.z)
sbux.z msft.z
Mar 1993
1.19
2.43
Apr 1993
1.21
2.25

27

MSFT
SBUX

10

20

Prices30

40

50

1.3 RETURN CALCULATIONS IN R

1994

1996

1998

2000

2002

2004

2006

2008

MonthsFigure 1.2: Time series plot for zoo object.
May 1993
Jun 1993
Jul 1993
Aug 1993

1.50
1.53
1.48
1.52

2.44
2.32
1.95
1.98

As illustrated in Figures 1.2 and 1.3, time series graphs with dates on theaxes can be easily created:# two series on same graph> plot(msft.z, lwd=2, col="blue", ylab="Prices", xlab="Months")> lines(sbux.z, col="black", lwd=2, lty="dotted")> legend(x="topleft", legend=c("MSFT", "SBUX"), col=c("blue", "black"),+
lwd=2, lty=c("solid", "dotted"))# two series in two separate panels> plot(sbuxMsft.z, lwd=c(2,2), plot.type="multiple",+
col=c("black", "blue"), lty=c("solid", "dotted"),+ylab=c("SBUX", "MSFT"), main="")With prices in a zoo object, simple and continuously compounded returns
can be easily computed using the diff() and lag() functions:

28

20
30
20
10

MSFT

40

500

10

SBUX

30

CHAPTER 1 RETURN CALCULATIONS

1994

1996

1998

2000

2002

2004

2006

2008

Index

Figure 1.3: Multi-panel time series plot for zoo objects.
> sbuxRet.z = diff(sbux.z)/lag(sbux.z, k=-1)> sbuxRetcc.z = diff(log(sbux.z))> head(merge(sbuxRet.z, sbuxRetcc.z))sbuxRet.z sbuxRetcc.z
Apr 1993
0.016810.01667
May 1993
0.23967
0.21484
Jun 1993
0.02000
0.01980
Jul 1993 -0.03268-0.03323
Aug 1993
0.02703
0.02667
Sep 1993
0.12500
0.11778
Simple and continuously compounded returns can also be computed using
the PerformanceAnalytics function CalculateReturns():> sbuxMsftRet.z = CalculateReturns(sbuxMsft.z, method="simple")> head(sbuxMsftRet.z)
sbux.zmsft.zApr 1993 0.01681 -0.07407
May 1993 0.23967 0.08444
Jun 1993 0.02000 -0.04918

1.3 RETURN CALCULATIONS IN R

29

Jul 1993 -0.03268 -0.15948
Aug 1993 0.02703 0.01538
Sep 1993 0.12500 0.09596> sbuxMsftRetcc.z = CalculateReturns(sbuxMsft.z, method="compound")> head(sbuxMsftRetcc.z)
sbux.zmsft.zApr 1993 0.01667 -0.07696
May 1993 0.21484 0.08107
Jun 1993 0.01980 -0.05043
Jul 1993 -0.03323 -0.17374
Aug 1993 0.02667 0.01527
Sep 1993 0.11778 0.09163
The PerformanceAnalytics package contains several useful charting
functions specially designed for financial time series. Fancy time series plots
with event labels and shading can be created with chart.TimeSeries():# dates are formated the same way they appear on the x-axis> shading.dates = list(c("Jan 98", "Oct 00"))> label.dates = c("Jan 98", "Oct 00")> label.values = c("Start of Boom", "End of Boom")> chart.TimeSeries(msft.z, lwd=2, col="blue", ylab="Price",+
main="The rise and fall of Microsoft stock",+
period.areas=shading.dates, period.color="yellow",+
event.lines=label.dates, event.labels=label.values,+
event.color="black")
Two or more investments can be compared by showing the growth of $1
invested over time using the function chart.CumReturns():> chart.CumReturns(sbuxMsftRet.z, lwd=2, main="Growth of $1",+
legend.loc="topleft")quantmodThe quantmod package for R, written by Jeﬀ Ryan, is designed to assist thequantitative trader in the development, testing, and deployment of statistically based trading models. See www.quantmod.com for more information
about the quantmod package. Table 1.1 summarizes the functions in the

30

CHAPTER 1 RETURN CALCULATIONS

End of Boom

10

20

Price

30

40

Start of Boom50

The rise and fall of Microsoft stock

03/93

09/94

03/96

09/97

03/99

09/00

03/02

09/03

03/05

09/06

03/08

Date

Figure 1.4: Fancy time series chart created with chart.TimeSeries().
package for retrieving data from the internet, performing return calculations,and plotting financial data.
Several functions in quantmod (i.e., those starting with get) automatically download specified data from the internet and import this data
into R objects (typically "xts" objects). For example, to download fromfinance.yahoo.com all of the available daily data on Yahoo! stock (ticker
symbol YHOO) and create the "xts" object YHOO use the getSymbols()
function:> library(quantmod)> getSymbols("YHOO")[1] "YHOO"> class(YHOO)[1] "xts" "zoo"> colnames(YHOO)[1] "YHOO.Open""YHOO.High""YHOO.Low"[5] "YHOO.Volume""YHOO.Adjusted"> start(YHOO)[1] "2007-01-03"> end(YHOO)"YHOO.Close"

31

1.3 RETURN CALCULATIONS IN R

30

Growth of $1

15
0

5

10

Value

20

25

sbux.zmsft.z

04/93

10/94

04/96

10/97

04/99

10/00

04/02

10/03

04/05

10/06

Date

Figure 1.5: Growth of $1 invested in Microsoft and Starbucks stock.
[1] "2009-10-02"> head(YHOO)YHOO.Open YHOO.High YHOO.Low YHOO.Close YHOO.Volume
2007-01-03
25.85
26.26
25.26
25.61
26352700
2007-01-04
25.64
26.92
25.52
26.85
32512200
2007-01-05
26.70
27.87
26.66
27.74
64264600
2007-01-08
27.70
28.04
27.43
27.92
25713700
2007-01-09
28.00
28.05
27.41
27.58
25621500
2007-01-10
27.48
28.92
27.44
28.70
40240000
YHOO.Adjusted
2007-01-03
25.61
2007-01-04
26.85
2007-01-05
27.74
2007-01-08
27.92
2007-01-09
27.58
2007-01-10
28.70
To create the daily price-volume chart of the YHOO data shown in Figure
1.6, use the chartSeries() function:> chartSeries(YHOO,theme=chartTheme(’white’))32

CHAPTER 1 RETURN CALCULATIONSFunction

Description

chartSeries

Create financial charts

getDividends

Download dividend data from Yahoo!

getFX

Download exchange rates from Oanda

getFinancials Download financial statements from google
getMetals

Download metals prices from Oanda

getQuote

Download quotes from various sources

getSymbols

Download data from various sources

periodReturn

Calculate returns from prices

Table 1.2: quantmod return calculation and plotting functions

1.4

Notes and Complements

This chapter describes basic asset return calculations with an emphasis onequity calculations. Campbell, Lo and MacKinlay (1997) provide a nicetreatment of continuously compounded returns. A useful summary of a broad
range of return calculations is given in Watsham and Parramore (1998).
A comprehensive treatment of fixed income return calculations is given in
Stigum (1981), and the oﬃcial source of fixed income calculations is theso-called “The Pink Book”.

1.5 APPENDIX: PROPERTIES OF EXPONENTIALS AND LOGARITHMS33
YHOO[2007-01-03/2009-10-02]
35

Last 16.84
30

25

20

15

10
400

Volume (millions):
32,674,700

300
200
100
0
Jan 03 2007

Jan 02 2008

Jan 02 2009

Oct 02 2009

Figure 1.6: Daily price-volume plot for Yahoo! stock created with the quantmod function chartSeries().

1.5

Appendix: Properties of exponentials andlogarithms

The computation of continuously compounded returns requires the use ofnatural logarithms. The natural logarithm function, ln(·) is the inverse of
the exponential function, (·) = exp(·) where 1 = 2718 That is, ln() is
defined such that  = ln( ) Figure 1.7 plots  and ln(). Notice that is always positive and increasing in . ln() is monotonically increasing in 
and is only defined for   0 Also note that ln(1) = 0 and ln(−∞) = 0The exponential and natural logarithm functions have the following properties
1. ln( · ) = ln() + ln()    0
2. ln() = ln() − ln()    0
3. ln( ) =  ln()   0
4.  ln()= 1    0
1 ln(()) =  () () (chain-rule)
5. 


34

CHAPTER 1 RETURN CALCULATIONS

2
-2

0

y

4

6

exp(x)
ln(x)

-1.0

-0.5

0.0

0.5

1.0

1.5

2.0

x

Figure 1.7: Exponential and natural logarithm functions.

6.   = +

7.  − = −

8. ( ) = 

9. ln() =  
10. 
 =   ()11. =  ()  () (chain-rule)Bibliography[1] Campbell, J., A. Lo, and C. MacKinlay (1997), The Econometrics ofFinancial Markets, Princeton University Press.
[2] Handbook of U.W. Government and Federal Agency Securities and Related Money Market Instruments, “The Pink Book”, 34th ed. (1990), The
First Boston Corporation, Boston, MA.
[3] Stigum, M. (1981), Money Market Calculations: Yields, Break Evens andArbitrage, Dow Jones Irwin.
[4] Watsham, T.J. and Parramore, K. (1998), Quantitative Methods in Finance, International Thomson Business Press, London, UK.
[5] Wüertz, D., Chalabi, Y., Chen, W., and Ellis, A. (2009). Portfolio Optimization with R/Rmetrics, eBook, Rmetrics Association & Finance Online.

35