Skip to content
Start free

Why do small towns have the highest (and lowest) rates?

See how a rate built on a few cases jumps from one year to the next, and learn not to reward or punish a place for it.

Free course. Your Maestro, an AI, .

Your table from the previous page ended with a surprise: Ojo de Agua, with 2,450 people and 7 thefts, has the highest rate in the region, 285.7 per 100,000. A local paper already has its story ready: "Ojo de Agua, the most dangerous municipality for businesses."

Before you look at the previous year, think about what you expect.

Check yourself: In 2024, Ojo de Agua had 1 theft from a business and El Encino (3,100 people) had 8, the highest rate that year. In 2025, Ojo de Agua had 7 and El Encino 1. What best explains those changes?

What one case is worth

A rate per 100,000 is cases ÷ population × 100,000. If the population is small, each case weighs a lot. Try it:

What happens to the theft rate per 100,000 inhabitants if there is one more theft in the year?

What happens to the theft rate per 100,000 inhabitants if there is one more theft in the year?

One more theft in Ojo de Agua

Example 1 of 2

ojo_de_agua.py
poblacion = 2_450
un_robo = 1 / poblacion * 100_000
print(round(un_robo, 1))

A guess is fine: it's kept as you wrote it, so you can compare. Only you and your Maestro see your predictions.

Example 2 of 2, opens once you explain this one

Make your prediction

Now look at all 18 municipalities (synthetic course data, 2025). In the chart, each point is a municipality: across, its population, on a so everything from 2,450 to 1,420,000 people fits, and up, its 2025 rate.

Use the left and right arrow keys to change steps.

Step 1 of 4

The 18 municipalities

On the left, the towns; on the right, the cities. Before you go on, see which side the highest and lowest points are on.

What to do with small numbers

The point isn't to ignore small towns. Their people matter just as much, and a real problem can start there. The point is not to tell a story that seven cases can't support. Four practical fixes:

  • Give the count next to the rate. "285.7 per 100,000 (7 thefts)" reads very differently from "285.7 per 100,000."
  • Pool years. Add up the cases from two or three years and divide by the population over those years. The jumps even out.
  • Pool places. Group the small municipalities ("municipalities with fewer than 20,000 people") and calculate one rate for the group.
  • Set a minimum. Don't publish the rate for a place with fewer than a set number of cases (say, 20); give only its count. Pick your minimum before you see the results, not after.

The same goes beyond municipalities: the branch with the best repeat purchase rate of the month, the salesperson with the highest close rate, the school with the best average. If it's small, it's probably at an extreme by luck, and next period it falls back into the pack.

If you have a ranking at work that changes a lot from one month to the next, ask your Maestro whether small numbers could be the reason.

Try it

Pool the two years. The query below calculates each municipality's 2024 and 2025 rates. Add a column tasa_dos_anios: the thefts from both years, divided by the population times 2 (because it's two years' worth of people), per 100,000. Sort by that column.

If it's not clear why the population is multiplied by 2, ask your Maestro.

Add tasadosanios = ROUND((robos2024 + robos2025) 100000.0 / (2 poblacion), 1) as the last column, and sort by tasadosanios from highest to lowest and then by municipio. You're done when Villa Morena is at the top with 242.1 and Ojo de Agua drops to 163.3.

Your turn

Add tasa_dos_anios = ROUND((robos_2024 + robos_2025) * 100000.0 / (2 * poblacion), 1) as the last column, and sort by tasa_dos_anios from highest to lowest and then by municipio. You're done when Villa Morena is at the top with 242.1 and Ojo de Agua drops to 163.3.

Tables: municipios (municipio, poblacion, robos_2024, robos_2025)

municipios · 18 rows

ColumnType
municipio Nombre del municipio (ficticio).VARCHAR
poblacion Habitantes del municipio.BIGINT
robos_2024 Robos a comercio denunciados en 2024.BIGINT
robos_2025 Robos a comercio denunciados en 2025.BIGINT

First rows

municipiopoblacionrobos_2024robos_2025
Ciudad Ceiba142000021302272
San Telmo6120001040980
Puerto Viejo385000480521

Every run starts from fresh copies of the course's tables, so try anything.

Ready to run your query.

Run it yourself

With both years pooled, Villa Morena comes out on top, where the chart already pointed. Ojo de Agua and El Encino drop to mid-table. With 8 or 9 thefts in two years they're still small numbers, but they no longer jump from the bottom to the top.

The paper's story should have been a different one: "Villa Morena, the highest rate in the region two years running." That one you can put your name to.

Check yourself: El Encino went from 258 to 32 thefts per 100,000 inhabitants (from 8 thefts to 1). Its mayor boasts that his security strategy cut thefts by 87%. What would you tell him?