check_heaping_kannisto: Kannisto's age heaping index

View source: R/check_heaping.R

check_heaping_kannistoR Documentation

Kannisto's age heaping index

Description

This age heaping index is used for particular old ages, such as 90, 95, 100, 105, and so forth.

Usage

check_heaping_kannisto(Value, Age, Agei = 90, pow = "exp")

Arguments

Value

numeric. A vector of demographic counts or rates by single age.

Age

integer. A vector of ages corresponding to the lower integer bound of the counts.

Agei

integer. The age on which the index is centered.

pow

either "exp" (default) or a power such as 2. See details

Details

The index looks down two ages and up two ages, so the data must accommodate that range. The denominator is a mean of the counts in the surrounding 5 single ages. The kind of mean can be controlled with the pow argument. By default, this takes the antilog of the arithmetic mean of the natural log of the five denominator counts. That will fail if one of the counts is equal to 0. In such cases, another power, such as 2 or 10 or 100 may be used, which is more robust to 0s. The higher the power, the closer the result will resemble the default output. If pow=="exp" but a 0 is detected among the denominator ages, then pow is assigned a value of 1000. pow=1 would imply an arithmetic mean in the denominator.

Value

The value of the index.

References

\insertRef

kannisto1999assessingDemoTools

Examples

Age <- 0:99
check_heaping_kannisto(pop1m_pasex, Age, 90)
check_heaping_kannisto(pop1m_pasex, Age, 95)
check_heaping_kannisto(pop1m_pasex, Age, 95, pow = 2) # geometric mean in denom
check_heaping_kannisto(pop1m_pasex, Age, 95, pow = 1000) # similar, but robust to 0s
check_heaping_kannisto(pop1m_pasex, Age, 95, pow = 1) # arithmetic mean in denom
pop1m_pasex[Age==95] / mean(pop1m_pasex[Age >= 93 & Age <= 97])

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