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.

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. integer vector of age group lower bounds. logical. Whether or not the top age group is open. Default TRUE. integer. Lower age bound to adjust values. integer. Upper age bound to adjust values.

## Value

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

## 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.

## 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)
if (FALSE) {
plot(Age, dth5_zigzag)
lines(as.integer(names(zz)),zz)
}