smooth_age_5_zigzag_p | R Documentation |
This function is auxiliary to zigzag()
, see ?zigzag
for a description.
smooth_age_5_zigzag_p(
Value,
Age,
ageMin = 40,
ageMax = 80,
p = rep(0.05, floor((ageMax - ageMin)/10))
)
Value |
numeric vector of (presumably) counts in 5-year age groups. |
Age |
integer vector of age group lower bounds. |
ageMin |
integer. Lower age bound to adjust values. |
ageMax |
integer. Upper age bound to adjust values. |
p |
numeric vector of adjustment parameters. |
This function is not intended to be used at the top level, but just in case, make sure that ageMax = ageMin + 10 * length(p)
. Age groups >= ageMin
AND <= ageMin
must be in 5-year age groups. This function does no checks.
numeric vector of smoothed population counts.
Feeney, G. 2013 "Removing "Zigzag" from Age Data," http://demographer.com/white-papers/2013-removing-zigzag-from-age-data/
Age <- c(0,1,seq(5,90,by=5))
smooth_age_5_zigzag_min(dth5_zigzag,Age,ageMin=40,ageMax = 80,p=rep(.05,4))
# it's used like this in smooth_age_5_zigzag_inner()
(p <- optim(
rep(.05,4),
smooth_age_5_zigzag_min,
Value = dth5_zigzag,
Age = Age,
ageMin = 40,
ageMax = 80)$par)
Smoothed <- smooth_age_5_zigzag_p(dth5_zigzag,Age,40,80,p)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.