Exploratory and applied analysis · lesson 5 of 11
Parts in this lesson
Aprice * cpi_base / cpia price in base-month pesos
B(1 + g) / (1 + pi) - 1real growth, exactly

Prices and inflation

Last updated

Batangas took 2.5% more pesos in 2024 than in 2023. But prices rose too: the same pesos bought less. Did the store really grow? In this lesson you'll learn what the consumer price index is, convert peso amounts from different years into the pesos of one base month, and work out real growth: what's left of growth once inflation is taken out.

By the end of this lesson you can

  • Explain nominal and real prices, and what the CPI measures
  • Convert peso amounts into the pesos of a base month
  • Compute real growth, roughly and exactly

Nominal and real

A nominal amount is in the pesos of its own day: the price on the shelf, the takings in the book. A real amount is converted into the pesos of one chosen month, so amounts from different times can be compared by what they would buy.

The Tindahan sold rice at ₱40 a kilo in January 2022 and ₱48 in December 2024: up 20%. But a peso in 2024 bought less than a peso in 2022. To compare, put both into the same pesos. Move the base month:

Rice, real against nominalpesos a kilo
₱40₱45₱50202220232024as chargedin Dec 2024 pesos

As charged, rice went from ₱40 to ₱48: up 20.0%. In Dec 2024 pesos, from ₱45.6 to ₱48.0: up 5.2%. The base month changes the level of the pink line, never its shape.

In December-2024 pesos, the January 2022 price was about ₱45.60, so rice really rose by about 5%, not 20%. Most of the rise was everything getting dearer. Picking another base month moves the pink line up or down but never changes its shape: the real change between any two months is the same whatever the base.

The consumer price index

The consumer price index (CPI) is the price of a fixed basket of goods and services a typical household buys (food, rent, transport, electricity, school fees) as an index (9.4): 100 in a base year. The Philippine Statistics Authority (PSA) prices the basket across the country every month and publishes the CPI and the inflation rate, the CPI's change over a year.

This course uses a course-made CPI in data/clean/cpi.csv, built to rise like the published rates: prices rose about 6% a year in 2022 and 2023, then about 3% in 2024. For real work, download the PSA's series from OpenSTAT, for the region or province that matches your data. Run the cells.

real_prices.ipynb

The second cell computes inflation the way the PSA reports a yearly figure: the year's average CPI against the year before. In the course data: 5.8% in 2023 and 3.3% in 2024.

Converting to a base month

To put a price pt from month t into the pesos of a base month:

ptreal=pt×CPIbaseCPIt

If the CPI was 112.7 in January 2022 and 128.5 in December 2024, then ₱40 in January 2022 is 40×128.5/112.7≈ ₱45.6 in December-2024 pesos. That's the first row of the table in step 2: the rice price ₱40, ₱41, ₱46, ₱48 in four months becomes ₱45.6, ₱43.6, ₱46.8, ₱48.0 in December-2024 pesos. In real terms rice got cheaper in 2022, then dearer from late 2023.

Real growth compares two real amounts. Roughly, it's nominal growth minus inflation; exactly, with nominal growth g and inflation π (the Greek letter pi, here an inflation rate):

real growth=1+g1+π−1

For small rates the two are almost the same; for big ones, use the exact one.

Wrong way: a rise that isn't

The owners' summary says: "All stores grew in 2024 except Rosario. Batangas was up 2.5%." Run the cells: the same yearly totals, nominal and real.

real_prices.ipynb
nominalreal
Tanauan+13.4%+9.9%
Lipa+8.1%+4.8%
Batangas+2.5%−0.7%
Rosario−1.5%−4.5%

Batangas took 2.5% more pesos while prices rose 3.3%. Its pesos bought 0.7% less than the year before: in real terms, it shrank. (The second cell gets the same answer both ways: 2.52−3.26≈−0.7, and exactly 1.0252/1.0326−1=−0.7%.) The real story is two stores growing, two shrinking.

The check: whenever you compare peso amounts more than a few months apart, ask whether prices changed in between. Compare in real pesos, say which base month you used ("in December-2024 pesos"), and say where the CPI came from.

Check what you learned

A salary rose 10% in a year when inflation was 8%. Predict the real rise, exactly.
The CPI was 100 in 2018 and 125 in 2024. What is ₱1,000 from 2018 worth in 2024 pesos?

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