smooth_age_5_arriaga | R Documentation |
Smooth population counts in 5-year age groups.
smooth_age_5_arriaga(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. 10-year age groups are constrained to sum to their original totals.
numeric vector of smoothed counts in 5-year age groups.
arriaga1994populationDemoTools \insertRefarriaga1968newDemoTools
Ages <- seq(0, 80, by = 5)
AMales <- smooth_age_5_arriaga(Value = pop5m_pasex, Age = Ages, OAG = TRUE)
# PAS spreadsheet result:
Atest <- c(662761, 495126, 345744, 287629, 285919, 261018, 237469, 203277,
161733, 126960, 88586, 67496, 54587, 41257, 28790, 17189, 34729)
all(round(AMales) - Atest == 0, na.rm = TRUE)
## Not run:
plot(Ages, pop5m_pasex)
lines(as.integer(names(AMales)),AMales)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.