Worked capstone: common-period population change
On this page
Attempt the independent investigation before reading this reference. It answers one bounded descriptive question: how do absolute and relative population changes between 2018 and 2023 compare for the three selected countries in the saved World Bank snapshot? The source is World Development Indicators, SP.POP.TOTL, with acquisition and licence metadata supplied. It is not a representative world sample or a causal study.
Define, validate and calculate
Require one record per country-year, positive observed population, and both common endpoints for every selected country. Absolute change is the later total minus the baseline; relative change divides that difference by the baseline and multiplies by 100. These measures can rank countries differently because their baselines differ.
from pathlib import Path
import pandas as pd
from book2lab import population_capstone
comparison = population_capstone(Path('data/completion/worldbank/population.csv'), Path('outputs/capstone'))
print(comparison)
assert comparison.loc['DEU','absolute_change'] == 381491
assert comparison.loc['FRA','absolute_change'] == 1213938
assert comparison.loc['GBR','absolute_change'] == 2239000Verify one result independently
For Germany, the saved endpoints are 82,905,782 and 83,287,273. Their difference is 381,491. Divide by 82,905,782 to obtain the relative change, then compare with the exported table. Repeat for another country without relying on the same function to provide both calculation and expected result.
Write the analytical conclusion
The selected countries all have larger reported totals in the 2023 endpoint than in 2018 in this snapshot. The table quantifies those differences under the source’s population definition. These totals do not separately identify births, deaths, migration or the causal effect of a policy. Estimates can be revised; preserve the snapshot identity.
The output table is ready for a labelled absolute-change bar comparison or a baseline-indexed temporal figure. Choose the view from the question and retain all annual observations when examining trajectories. Do not sum annual population stocks to claim a count of distinct people.
Sensitivity experiment and handoff
Remove a baseline record in a separate copy and verify that a common-endpoint analysis rejects the incomplete comparison. A first-available-year calculation would answer a different question and must be labelled differently. For possible later prediction, document the target horizon and information available before it; six annual observations per country do not establish that a robust forecasting model can be fitted.
A complete submission includes the brief, source register, dictionary, quality checks, derived tables, executable code, report and chart/model handoff. Alternative valid questions may require different outputs. The assessment rewards justified choices and traceability rather than matching this reference’s wording.