 # Compound growth rates

Explore this snippet with some demo data here.

# Description

When a quantity is increasing in time by the same fraction every period, it is said to exhibit compound growth - every time period it increases by a larger amount.

It is possible to show that the behaviour of the quantity over time follows the law

``````x(t) = x(0) * exp(r * t)
``````

where

• `x(t)` is the value of the quantity now
• `x(0)` is the value of the quantity at time t = 0
• `t` is time in units of [time_period]
• `r` is the growth rate in units of 1 / [time_period]

# Calculating growth rates

From the equation above, to calculate a growth rate you need to know:

• The value at the start of a period
• The value at the end of a period
• The duration of the period

Then, following some algebra, the growth rate is given by

``````r = ln(x(t) / x(0)) / t
``````

#### Example

For a concrete example, assume a table with columns:

• `num_this_month` - this is `x(t)`
• `num_last_month` - this is `x(0)`

In the following then, `growth_rate` is the equivalent yearly growth rate for that month: