How to Compute the Compound Annual Growth Rate

We know that the compound annual growth rate (CAGR) is the mean annual growth rate of an investment over a specified period of time longer than one year.

Let us consider Disney’s (NYSE: DIS) 10 year book value per share from 2002 – 2011 and compute its CAGR over that period:

Year Book Value
2002 $11.61
2003 $11.82
2004 $13.05
2005 $13.06
2006 $15.42
2007 $15.67
2008 $17.73
2009 $18.55
2010 $19.78
2011 $21.21

our present value starting 2002 is PV=$11.61. Our future value (measure in 2011) is FV=$21.21. We know that:

FV=PV (1 + r)^n

where r is the annual rate of return and n is the number of periods over which we are compounding our value.

So in order for us to calculate the compound annual growth rate, r, we need to divide the value of an investment at the end of the period, FV, by its value at the beginning of that period, PV, and raise the result to the power of one divided by the period length n (or n-th root), and subtract one from the subsequent result:

r=(\frac{FV}{PV})^{(\frac{1}{n})} - 1

For our Disney example this would be:

(\frac{21.21}{11.61})^{(\frac{1}{9})} - 1=0.0692 or 6.92\%

import argparse
import math
import locale
from termcolor import colored
import sys


def main():
    """
    python3 compound_annual_growth_rate.py -p 1000 -f 2000 -n 10
    """
    parser = argparse.ArgumentParser()
    parser.add_argument('-p', type=float, default=11.61, help='Present value at the beginning of period e.g.: 11.61')
    parser.add_argument('-f', type=float, default=21.21, help='Future value at the end of period e.g.: 21.21')
    parser.add_argument('-n', type=int, default=9, help='The number of years it took the value to grow')
    args = parser.parse_args()

    print("-----------------------------------------------------------------------")
    print("Compute the Compound Annual Growth Rate Calculator")
    print("-----------------------------------------------------------------------")

    r = (args.f / args.p)**(1/float(args.n)) - 1
    r = r * 100

    print("Compound Annual Growth Rate: %s%%\n" % (colored("%.2f" % r, 'green')))


if __name__ == '__main__':
    main()