Smooth population counts in 5-year age groups.

smooth_age_5_un(Value, Age, OAG = TRUE)

Arguments

Value

numeric vector of counts in single, abridged, or 5-year age groups.

Age

numeric vector of ages corresponding to the lower integer bound of the counts.

OAG

logical. Whether or not the top age group is open. Default TRUE.

Value

numeric vector of smoothed counts in 5-year age groups.

Details

The open age group is aggregated down to be evenly divisible by 10. This method accounts for the youngest and oldest age groups. Age classes must be cleanly groupable to 5-year age groups. Counts are not constrained in 10-year age groups, except 10-year young and old tails, which are unaffected.

References

Carrier NH, Farrag AM (1959). “The reduction of errors in census populations for statistically underdeveloped countries.” Population Studies, 12(3), 240--285. Arriaga EE, Johnson PD, Jamison E (1994). Population analysis with microcomputers, volume 1. Bureau of the Census.

Examples

Ages <- seq(0, 80, by = 5) un_test <- c(NA,NA,364491,279123,268724,272228,243638,200923,162752,126304, 91662,67432,54677,38833,NA,NA,NA) un_result <- smooth_age_5_un(pop5m_pasex, Ages, TRUE) all(round(un_result) - un_test == 0, na.rm = TRUE)
#> [1] TRUE
if (FALSE) { plot(Ages, pop5m_pasex) lines(as.integer(names(un_result)),un_result) }