View source: R/check_heaping.R
check_heaping_kannisto | R Documentation |
This age heaping index is used for particular old ages, such as 90, 95, 100, 105, and so forth.
check_heaping_kannisto(Value, Age, Agei = 90, pow = "exp")
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 |
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.
The value of the index.
kannisto1999assessingDemoTools
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])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.