Exploratory and applied analysis · lesson 4 of 11
Parts in this lesson
A1000 * pesos / populationa rate per 1,000 people
B(end / start) ** (1 / years) - 1compound annual growth rate
C100 * wide.div(wide[2022], axis=0)an index, base year = 100

Rates, ratios and indexes

Last updated

Batangas takes the most money. Is it the best store? It's also in a big city. Totals favour whatever is biggest; to compare fairly you divide by something: people, days, receipts. In this lesson you'll turn totals into rates, measure change as a percentage, in percentage points and as a yearly growth rate, and put stores of different sizes on one scale with index numbers.

By the end of this lesson you can

  • Compare fairly with rates: per person, per day, per receipt
  • Tell a percentage change from a change in percentage points
  • Compute a compound annual growth rate
  • Build an index with a base year of 100

Totals against rates

A total answers "how much altogether". A rate divides it by something, to answer "how much for each": per person, per day open, per receipt. Which you divide by depends on the question. Switch between them:

Totals against ratesTotal pesos, 2024
Batangas₱1,124,352Lipa₱909,079Tanauan₱809,801Rosario₱559,791

Ranked by total pesos, 2024: Batangas, Lipa, Tanauan, Rosario.

The ranking changes with the measure. Batangas has the biggest total and the most per day open. But per 1,000 people in its town, Rosario comes first: it's the smallest store in the smallest town, and reaches more of its town than the others. Per receipt, the four are within half a peso of each other, so their order there is noise. Now in pandas:

rates.ipynb

The populations come from the Philippine Statistics Authority's 2020 census, in data/clean/towns.csv. Each rate answers a different question:

  • Per 1,000 people (₱4,361 at Rosario, ₱2,438 at Lipa): how much of its town each store reaches. Rates per 1,000 or 100,000 people are how health, crime and income figures are compared between places (9.8).
  • Per day open (₱3,097 at Batangas, ₱1,546 at Rosario): how busy a store is on an ordinary day.
  • Per receipt (₱110.5 to ₱111.3): how big a typical sale is.

Percentage change and growth rates

Run the cells.

rates.ipynb

A percentage change compares a new value with an old one:

xnew−xoldxold×100%

From 2023 to 2024, Tanauan grew 13.4%, Lipa 8.1%, Batangas 2.5%, and Rosario shrank 1.5%.

For more than one year, the compound annual growth rate (CAGR) is the steady yearly rate that would take the start value to the end value:

CAGR=(xendxstart)1/years−1

Tanauan went from ₱614,153 in 2022 to ₱809,801 in 2024, two years: (809,801/614,153)1/2−1, a CAGR of 14.8% a year. It isn't the average of the two yearly changes; it's the rate that compounds to the same end.

Index numbers

Comparing growth across stores of different sizes is easier on one scale. An index divides every value by the value in a base year and multiplies by 100:

It=100×xtxbase

The second cell in step 2 does it for every store with wide.div(wide[2022], axis=0): each row divided by its own 2022 value. Every store starts at 100; by 2024 Tanauan is at 131.9 (up 31.9% since 2022), Lipa 121.1, Batangas 110.7 and Rosario 100.1. Big and small stores now sit on one chart, and the reader sees growth, not size.

The consumer price index in 9.5 is the same idea: the price of a fixed basket of goods, as a percentage of its price in a base year.

Wrong way: up 8.4%

In 8.8, 26.1% of morning receipts were paid by GCash, and 34.5% of evening ones. A report says: "GCash use is 8.4% higher in the evening." The last cell in step 2 shows the problem:

  • The difference is 8.4 percentage points: 34.5 − 26.1.
  • As a percentage change, it's 32.2% higher: 8.4 ÷ 26.1.

"8.4% higher" is neither. It makes a third of a jump sound like a small one. When the thing that changes is itself a percentage (a share, a rate, an interest rate), there are two ways to describe the change, and both are useful:

  • Percentage points for the plain difference between two percentages.
  • Percent for the change relative to where it started.

The check: when you write a change in something that is already a percentage, say "percentage points" or "percent" and make sure it's the one you computed. If in doubt, give both: "up 8.4 percentage points, from 26.1% to 34.5%, a third more".

Check what you learned

A store’s takings rise from ₱500,000 to ₱720,000 over two years. Predict its CAGR.
Unemployment falls from 5% to 4%. Which is correct?
Town A has 200 dengue cases, town B has 50. Which has more of a dengue problem?

Sources

Every example on this page was run with Python 3.14, and its output and error messages are copied from it. These pages cover the same ground in more depth.

All sources for Simple Data Analysis