smooth_age_5_strong: A strong method of population count smoothing

View source: R/smooth_age_5.R

smooth_age_5_strongR Documentation

A strong method of population count smoothing

Description

Smooth population counts in 5-year age groups.

Usage

smooth_age_5_strong(Value, Age, OAG = TRUE, ageMin = 10, ageMax = 65)

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.

ageMin

integer. The lowest age included included in intermediate adjustment. Default 10.

ageMax

integer. The highest age class included in intermediate adjustment. Default 65.

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. All age classes are returned, but the strongest adjustment occurs in ages bounded by ageMin and ageMax. To be clear ageMax refers to the lower bound of the highest age class, inclusive. So, if you want a ceiling of 70 (default), specify 65. Counts are not constrained within this range, but the youngest 10-year age group and penultimate 10-year age group are perturbed but constrained to their original totals. The oldest 10-year age group is unaffected.

Value

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

References

\insertRef

carrier1959reductionDemoTools

Examples

Ages         <- seq(0, 80, by = 5)
strongtest <- c(646617,511270,386889,317345,273736,240058,218645,188297,
		153931, 124347,93254,71858,53594,39721,27887,18092,34729 )
strong_result <- smooth_age_5_strong(pop5m_pasex,Ages,TRUE)
# differences due to intermediate rounding in spreadsheet (bad practice IMO)
all(abs(strong_result - strongtest) < 1, na.rm = TRUE)
## Not run: 
plot(Ages, pop5m_pasex)
lines(as.integer(names(strong_result)),strong_result)

## End(Not run)

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