pkgdown/extra.scss

Skip to contents

Function to check if the components in the propop::propop() output add up. Takes the population at the beginning of the year (n_jan), adds all components (births - mor - emi_int - emi_nat + imm_int + imm_nat + acq) and checks if the sum is equal to the population at the end of the year (n_dec).

Usage

check_balance(data)

Arguments

data

data frame containing population projections; can be created with propop::propop().

Value

data frame containing summary statistics.

Examples

propop(
  parameters = fso_parameters,
  year_first = 2024,
  year_last = 2027,
  population = fso_population,
  subregional = FALSE,
  binational = TRUE
) |>
  check_balance()
#> Running projection for: Aargau (Scenario: high)
#>  Year: 2024
#>  Year: 2025
#>  Year: 2026
#>  Year: 2027
#> Running projection for: Aargau (Scenario: low)
#>  Year: 2024
#>  Year: 2025
#>  Year: 2026
#>  Year: 2027
#> Running projection for: Aargau (Scenario: reference)
#>  Year: 2024
#>  Year: 2025
#>  Year: 2026
#>  Year: 2027
#> 
#> ── Settings used for the projection ────────────────────────────────────────────
#> Scenario(s): "high", "low", and "reference"
#> Year of starting population: 2023
#> Number of age groups: 101
#> Fertile period: 16-50
#> Share of female newborns: 0.488
#> Size of starting population: 726894
#> Projection period: 2024-2027
#> Nationality-specific projection: "yes"
#> Subregional migration: "no"
#> ────────────────────────────────────────────────────────────────────────────────
#> Projected population size by 2027:
#> - Scenario "high": 768888
#> - Scenario "low": 748703
#> - Scenario "reference": 758993
#> ════════════════════════════════════════════════════════════════════════════════
#> 
#> ── Result of population equation components check ──────────────────────────────
#>  Total rows checked: 4848
#>  Check passed: Equations in all rows add up and there are no missing values.