smooth_age_5_kkn: Karup-King-Newton method of population count smoothing

View source: R/smooth_age_5.R

smooth_age_5_kknR Documentation

Karup-King-Newton method of population count smoothing

Description

Smooth population counts in 5-year age groups.

Usage

smooth_age_5_kkn(Value, Age, OAG = TRUE, start_on = 0)

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.

start_on

integer. Either 0 or 5. Do we constrain decades starting on the 0s or 5s?

Details

This method does not account for ages < 10 nor for the 10 year age interval prior to the open age group. These are returned imputed with NA. Age classes must be cleanly groupable to 5-year age groups. Smoothed counts are constrained to sum to original totals in 10-year age groups.

Value

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

References

\insertRef

carrier1959reductionDemoTools

Examples

Ages         <- seq(0, 80, by = 5)
KKNtest <- c(NA,NA,354871,278502,285508,261429,236513 ,
		204233,162138,126555,90094,65988,54803,41041,NA,NA,NA)

KKNmales <- smooth_age_5_kkn(pop5m_pasex, Ages, TRUE)
all(round(KKNmales) - KKNtest == 0, na.rm = TRUE)
## Not run: 
plot(Ages, pop5m_pasex)
lines(as.integer(names(KKNmales)),KKNmales)

## End(Not run)

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