smooth_age_5_arriaga: E. Arriaga's method of population count smoothing

View source: R/smooth_age_5.R

smooth_age_5_arriagaR Documentation

E. Arriaga's method of population count smoothing

Description

Smooth population counts in 5-year age groups.

Usage

smooth_age_5_arriaga(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. 10-year age groups are constrained to sum to their original totals.

Value

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

References

\insertRef

arriaga1994populationDemoTools \insertRefarriaga1968newDemoTools

Examples

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)

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