smooth_age_5_un | R Documentation |
Smooth population counts in 5-year age groups.
smooth_age_5_un(Value, Age, OAG = TRUE)
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 |
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.
numeric vector of smoothed counts in 5-year age groups.
carrier1959reductionDemoTools \insertRefarriaga1994populationDemoTools
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.