smooth_age_5_un: The old United Nations method of population count smoothing

View source: R/smooth_age_5.R

smooth_age_5_unR Documentation

The old United Nations method of population count smoothing

Description

Smooth population counts in 5-year age groups.

Usage

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.

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.

Value

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

References

\insertRef

carrier1959reductionDemoTools \insertRefarriaga1994populationDemoTools

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)
## Not run: 
plot(Ages, pop5m_pasex)
lines(as.integer(names(un_result)),un_result)

## End(Not run)

timriffe/DemoTools documentation built on Jan. 28, 2024, 5:13 a.m.