Practical 1

Example: Birth Rates in Stirling vs Glasgow

Question 1

Here is the data for two Local Authority Areas (LAA) in Scotland: Stirling and Glasgow City.

The crude birth rate is calculated as the number of births per 1000 people.
\[ \text{Birth Rate} = \frac{\text{Number of Births}}{\text{Number of People}} \cdot 1000 \]

Calculate the birth rate for each LAA

LAA n_people n_births birth_rate
Glasgow City 650300 6150 ?
Stirling 94210 659 ?

Question 2

We can decompose the birth rate into two components: A: the number of births per “woman of child bearing age”(Scotland uses ages 15-44)“, and B: the proportion of the population that are women aged 15-44.

\[ \text{Birth Rate} = A \cdot B \cdot 1000 \]
\[ \text{Birth Rate} = \frac{\text{Nr of Women 15-44}}{\text{Nr of People}} \cdot \frac{\text{Nr of Births}}{\text{Nr of Women 15-44}} \cdot 1000 \]

Calculate these below, and then multiply them to demonstrate to yourselves that this returns the same rates (give or take some rounding!) as the previous question.

LAA n_people n_women15to44 n_births w15-44 / people births / w15-44 birth_rate
Glasgow City 650300 161105 6150 A1 B1 A1 * B1 * 1000
Stirling 94210 17844 659 A2 B2 A2 * B2 * 1000

Question 3

What would Stirling’s birth rate be if:

  1. Women aged 15-44 made up the same proportion of its population as they do for Glasgow?

A1 * B2!

LAA w15-44 / people births / w15-44
Glasgow City A1 B1
Stirling A2 B2

Question 4

What would each LAA’s birth rates be if:

  • The proportion of the population comprised of women aged 15-44 was the same in both populations (i.e., at the average of the two)
  • The rates of births in women aged 15-44 were the same in both populations (i.e., at the average of the two)

B1 * ((A1+A2)/2)
B2 * ((A1+A2)/2)
and
A1 * ((B1+B2)/2)
A2 * ((B1+B2)/2)

LAA w15-44 / people births / w15-44
Glasgow City A1 B1
Stirling A2 B2

Question 5

The differences between these two pairs of standardised rates (when using the average of the two populations as the reference) provides the contribution of each factor on the total crude rate difference.

We know from the very first question that Stirling has a crude birth rate that is ~2.46 births per 1000 people fewer than Glasgow.

How much of this is due to Stirling having relatively fewer ‘women of child bearing age’?

(A2 - A1) * ((B1+B2)/2) / (R2 - R1)

LAA crude rate w15-44 / people births / w15-44
Glasgow City R1 A1 B1
Stirling R2 A2 B2

Get The Software

Question 6

Get either R or Stata open, and install the various packages.

In R: DasGuptR
We would recommend installing the development version

library(remotes)
install_github("josiahpjking/DasGuptR@develop")

In Stata, we’re assuming you are familiar with using Stata (if not, we recommend you use R instead). The relevant command is rdecompose

#| eval: false
ssc install rdecompose

Question 7

Here’s the data:

R

p01 <- data.frame(
  LAA = c("Glasgow City","Stirling"),
  n_people = c(650300,94210),
  n_women15to44 = c(161105,17844),
  n_births = c(6150,659)
)

Stata

clear
input str12 LAA long n_people long n_women15to44 int n_births
"Glasgow City" 650300 161105 6150
"Stirling" 94210 17844 659
end


Create the new factors, and use either dgnpop() (in R) or rdecompose (Stata) to conduct the decomposition.

Check that it matches your calculations above.

You might find it easiest to multiply the “births per woman aged 15-44” by 1000 when you create it.

In R, this will look something like this:

library(tidyverse)
library(DasGuptR)
p01 <- p01 |>
  mutate(
    propw =  ????
    bpw =  ???
  )

dres <- dgnpop(x = ???, 
       pop = "???",
       factors = c("???","???"))

dg_table(dres)

Question 8

We can split the birth rate further, into three different factors:

\[ \small \text{Birth Rate} = \frac{\text{Nr of Women}}{\text{Nr of People}} \cdot \frac{\text{Nr of Women 15-44}}{\text{Nr of Women}} \cdot \frac{\text{Nr of Births}}{\text{Nr of Women 15-44}} \cdot 1000 \]

Perform this decomposition now.

R

p01a <- data.frame(
  LAA = c("Glasgow City","Stirling"),
  n_people = c(650300,94210),
  n_women = c(332054, 48731),
  n_women15to44 = c(161105,17844),
  n_births = c(6150,659)
)

Stata

clear
input str12 LAA long n_people long n_women long n_women15to44 int n_births
"Glasgow City" 650300 332054 161105 6150
"Stirling"     94210  48731  17844  659
end

Choose your own

Just the same as above, but comparing England and Scotland.

\[ \small \text{Birth Rate} = \frac{\text{Nr of Women}}{\text{Nr of People}} \cdot \frac{\text{Nr of Women 15-44}}{\text{Nr of Women}} \cdot \frac{\text{Nr of Births}}{\text{Nr of Women 15-44}} \cdot 1000 \]

Data:

R

scot_v_eng <- 
  tribble(
    ~country, ~n_people, ~n_women, ~n_women1544, ~n_births,
    "Scotland", 5546900, 2851740, 1064441, 45763,
    "England", 58620101, 29895762, 11583779, 567708
  )

Stata

clear
input str8 country long n_people long n_women long n_women1544 long n_births
"Scotland"  5546900  2851740  1064441  45763
"England"   58620101 29895762 11583779 567708
end

In 2025 in the UK, the estimated weekly earnings per working aged Males was £179. The weekly earnings per working aged Females was only £7.

These numbers can be calculated as simply:

\[ \text{weekly £ per working aged person} = \frac{\text{total weekly earnings}}{\text{number of working aged people}} \]

This difference could be attributable to:

  • a greater number of males in the “labour force” (people who are employed or actively seeking employment. this excludes students etc).
  • higher rates of employment for males in the labour force compared to females in the labour force (employment bias)
  • males working more hours per week compared to females (i.e., fewer part time roles)
  • a higher average hourly wage for males compared to females (a pay bias - this is the typically “gender pay gap”, unadjusted for specific roles)

So we can decompose the total weekly earnings per person as:

\[ \text{weekly £ per working aged person} = A \cdot B \cdot C \cdot D \]

Where

  • A = proportion of working aged population in the labour force
  • B = the proportion of the labour force that are employed
  • C = the average hours worked per employee
  • D = the average earnings per hour

You can find this data for a whole load of different countries at https://ilostat.ilo.org/data/?cat_mode=subject, if you would like to do this for somewhere else.

R

work25 <- data.frame(
  pop = c("males","females"),
  working_age = c(23718900, 24613110),
  labour_force = c(18442860, 5767405),
  employees = c(4823169, 280557),
  avg_hours_pp = c(37.9, 31.7),
  total_weekly_earnings = c(4240916038, 178762504)
)

Stata

clear
input str7 pop long working_age long labour_force long employees float avg_hours_pp double total_weekly_earnings
"males"   23718900 18442860 4823169 37.9 4240916038
"females" 24613110 5767405  280557  31.7 178762504
end

The Scottish Environment Protection Agency (SEPA) provides data on the weights of waste that is generated, recycled, landfilled etc.

One indicator tracked by many countries and organisations is the amount of recycled waste per citizen, i.e.:
\[ \text{Recycled Tonnes Per Person} = \frac{\text{Recycled Waste}}{\text{Nr People}} \]

In Scotland, this indicator has actually decreased from 195kg per person in 2011 to 186kg per person in 2022. On face value this could be interpreted as an indication that we are, as a nation, recycling less!

But we can decompose the indicator into the amount of waste generated per person, and the proportion of waste that is recycled.

This decomposition will allow us to see how much of the decrease in the population indicator can be attributable to changes in the amounts of waste generated, or in the proportion of waste that is recycled.

\[ \text{Recycled Tonnes Per Person} = \frac{\text{Total Waste}}{\text{Nr People}} \cdot \frac{\text{Recycled Waste}}{\text{Total Waste}} \]

Data are available at https://josiahpjking.github.io/sgsss_std_decomp/data/recycling_2011_2022.csv