smooth_age_5_zigzag: G. Feeney's method of smoothing counts in 5-year age groups.

View source: R/smooth_age_5.R

smooth_age_5_zigzagR Documentation

G. Feeney's method of smoothing counts in 5-year age groups.

Description

If age heaping is much worse on 0's than on 5's then even counts in 5-year age bins can preserve a sawtooth pattern. Most graduation techniques translate the zig-zag/sawtooth pattern to a wave pattern. It is not typically desired. This method redistributes counts 'from' every second 5-year age group in a specified range 'to' the adjacent age groups. How much to redistribute depends on a detection of roughness in the 5-year binned data, which follows the formulas recommended by Feeney. This method does not alter the total population count, counts in the youngest 10 ages, nor in old ages. 10-year age groups in the middle age range are not constrained.

Usage

smooth_age_5_zigzag(
  Value,
  Age,
  OAG = TRUE,
  ageMin = 40,
  ageMax = max(Age) - max(Age)%%10 - 5
)

Arguments

Value

numeric vector of (presumably) counts in 5-year age groups.

Age

integer vector of age group lower bounds.

OAG

logical. Whether or not the top age group is open. Default TRUE.

ageMin

integer. Lower age bound to adjust values.

ageMax

integer. Upper age bound to adjust values.

Details

This function calls smooth_age_5_zigzag_inner(), but prepares data in a way consistent with other methods called by smooth_age_5(). It is probably preferable to call zigzag() from the top level, or else call this method from smooth_age_5() for more control over tail imputations.

Value

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

References

Feeney, G. 2013 "Removing "Zigzag" from Age Data," http://demographer.com/white-papers/2013-removing-zigzag-from-age-data/

Examples

Age <- c(0,1,seq(5,90,by=5))
# defaults
zz <- smooth_age_5_zigzag(dth5_zigzag, Age, OAG = TRUE, ageMin = 40, ageMax = 90)
## Not run: 
plot(Age, dth5_zigzag)
lines(as.integer(names(zz)),zz)

## End(Not run)

timriffe/DemoTools documentation built on Oct. 14, 2024, 12:53 p.m.