shift_census_ages_to_cohorts: shift census populations to match single year cohorts

View source: R/interp_coh.R

shift_census_ages_to_cohortsR Documentation

shift census populations to match single year cohorts

Description

Matches the (single) ages of a census to single cohorts. For use in intercensal interpolations. Ages are potentially blended to match single cohort line assuming that the population in each age is uniformly distributed over the age group.

Usage

shift_census_ages_to_cohorts(
  pop,
  age,
  date,
  censusYearOpt = "frac",
  OAG = TRUE
)

Arguments

pop

numeric vector. Population counts in age groups, presumably from a census with an exact reference date.

age

integer vector. Lower bound of single age groups

date

Either a Date class object or an unambiguous character string in the format "YYYY-MM-DD".

censusYearOpt

character or NA. Options include:

  • "frac" keep the partial cohort observed in the year of the census.

  • "drop" remove the partial cohort from the census year (and trim other outputs to match)

  • "extrap" inflate the partial cohort from the census year. Specifically we keep it the same as the input age 0.

  • NA return NA for the census year cohort size.

OAG

logical. Is the highest age group an open age? If TRUE

Examples

pop <- seq(10000,100,length.out = 101)
age <- 0:100
d1 <- "2020-01-01"
d2 <- "2020-07-01"
d3 <- "2020-12-21"

shift_census_ages_to_cohorts(pop, age, d1)
shift_census_ages_to_cohorts(pop, age, d2)
shift_census_ages_to_cohorts(pop, age, d3)
shift_census_ages_to_cohorts(pop, age, 2020.5)

timriffe/DemoTools documentation built on Oct. 14, 2024, 12:53 p.m.