Skip to contents

Projects the under-15 population of each district in a synthetic geography over a run of years, and derives the under-5 and total populations from it. The first year takes the under-15 population of the geography, each later year grows by growth_rate, and every district-year carries a small random departure from that trend.

Usage

simulate_population(
  admin = simulate_admin_frame(),
  years = 2023:2024,
  growth_rate = 0.03,
  noise_sd = 0.02,
  u5_share = 0.17,
  u15_share = 0.45,
  seed = 1L
)

Arguments

admin

A geography from simulate_admin_frame(). Default simulate_admin_frame().

years

Calendar years to cover. Default 2023:2024.

growth_rate

Annual growth of the population, as a proportion. Default 0.03.

noise_sd

Standard deviation of the random departure from trend, on the log scale. Default 0.02.

u5_share

Share of the total population aged under 5. Default 0.17.

u15_share

Share of the total population aged under 15. Default 0.45. Must be at least u5_share.

seed

Seed for the random draws. Default 1L. The caller's random state is left as it was.

Value

A tibble with one row per district and year and the columns country_iso3code, adm0, adm1, adm2, adm0_guid, adm1_guid, adm2_guid, year (integer), and u5_pop, u15_pop and total_pop (double, whole numbers).

Details

The column names follow how rise-afg reads polished_pop_adm2 in 02_scripts/2c_indicators/2civ_surveillance.R, 02_scripts/2c_indicators/2cvi_timeliness.R and 02_scripts/00_helper_functions/0j_spi_helpers.R.

Examples

admin <- simulate_admin_frame(n_provinces = 2, n_districts = 3)
simulate_population(admin, years = 2022:2024)
#> # A tibble: 18 × 11
#>    country_iso3code adm0  adm1  adm2  adm0_guid adm1_guid adm2_guid  year u5_pop
#>    <chr>            <chr> <chr> <chr> <chr>     <chr>     <chr>     <int>  <dbl>
#>  1 QZA              COUN… PROV… DIST… {83601C6… {8BE0325… {CB5CBBF…  2022  35200
#>  2 QZA              COUN… PROV… DIST… {83601C6… {8BE0325… {CB5CBBF…  2023  36848
#>  3 QZA              COUN… PROV… DIST… {83601C6… {8BE0325… {CB5CBBF…  2024  37187
#>  4 QZA              COUN… PROV… DIST… {83601C6… {8BE0325… {90AA9E9…  2022   9705
#>  5 QZA              COUN… PROV… DIST… {83601C6… {8BE0325… {90AA9E9…  2023   9746
#>  6 QZA              COUN… PROV… DIST… {83601C6… {8BE0325… {90AA9E9…  2024   9810
#>  7 QZA              COUN… PROV… DIST… {83601C6… {8BE0325… {84CD025…  2022  23719
#>  8 QZA              COUN… PROV… DIST… {83601C6… {8BE0325… {84CD025…  2023  24553
#>  9 QZA              COUN… PROV… DIST… {83601C6… {8BE0325… {84CD025…  2024  25208
#> 10 QZA              COUN… PROV… DIST… {83601C6… {FD1C15D… {231F0B6…  2022  21736
#> 11 QZA              COUN… PROV… DIST… {83601C6… {FD1C15D… {231F0B6…  2023  23216
#> 12 QZA              COUN… PROV… DIST… {83601C6… {FD1C15D… {231F0B6…  2024  23382
#> 13 QZA              COUN… PROV… DIST… {83601C6… {FD1C15D… {9E348F4…  2022  17704
#> 14 QZA              COUN… PROV… DIST… {83601C6… {FD1C15D… {9E348F4…  2023  17664
#> 15 QZA              COUN… PROV… DIST… {83601C6… {FD1C15D… {9E348F4…  2024  19450
#> 16 QZA              COUN… PROV… DIST… {83601C6… {FD1C15D… {BE47308…  2022  73956
#> 17 QZA              COUN… PROV… DIST… {83601C6… {FD1C15D… {BE47308…  2023  76219
#> 18 QZA              COUN… PROV… DIST… {83601C6… {FD1C15D… {BE47308…  2024  80027
#> # ℹ 2 more variables: u15_pop <dbl>, total_pop <dbl>