check_heaping_bachi: calculate Bachi's index of age heaping

View source: R/check_heaping.R

check_heaping_bachiR Documentation

calculate Bachi's index of age heaping

Description

Bachi's index involves applying the Whipple method repeatedly to determine the extent of preference for each final digit. Similarly to Myers', it equals the sum of the positive deviations from 10 percent. It has a theoretical range from 0 to 90, and 10 is the expected value for each digit. There are two implementations.

Usage

check_heaping_bachi(
  Value,
  Age,
  ageMin = 23,
  ageMax = NULL,
  method = "orig",
  details = FALSE,
  OAG = TRUE
)

Arguments

Value

numeric. A vector of demographic counts by single age.

Age

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

ageMin

the minimum age used for estimation, default 23

ageMax

the maximum age used for estimation, default 77

method

either "orig" or "pasex"

details

logical. Should a list of output be given

OAG

logical. Is the highest age group open?

Details

ageMax is an inclusive upper bound, treated as interval. If you want ages 23 to 77, then give ageMin = 23 and ageMax = 77. The ageMin is respected strictly, whereas ageMax is calculated flexibly- if you specify something too high then it is reduced and we warn accordingly, and if it's missing then we pick something reasonable. You can see the age ranges actually used by specifying details = TRUE.

Value

The value of the index.

References

\insertRef

PASDemoTools \insertRefbachi1951tendencyDemoTools \insertRefshryock1973methodsDemoTools

Examples

 check_heaping_bachi(pop1m_pasex, Age = 0:99, 
 ageMin = 23, ageMax = 77, method = "orig", OAG =FALSE)
 check_heaping_bachi(pop1m_ind, Age = 0:100, 
 ageMin = 23, ageMax = 77, method = "orig")
 # default simpler
 check_heaping_bachi(pop1m_pasex, Age = 0:99, 
 ageMin = 23, ageMax = 77, method = "pasex", OAG = FALSE)
# linear population, should give 0 for pasex
 check_heaping_bachi(seq(100000,1000,by=-1000),Age = 0:99, 
 ageMin = 23, ageMax = 77, method = "pasex", OAG = FALSE)
# fully concentrated, should give 90 
 pop_concetrated <- rep(c(100,rep(0,9)),10)
 check_heaping_bachi(pop_concetrated, Age = 0:99, 
 ageMin = 23, ageMax = 77, method = "pasex")
 check_heaping_bachi(pop_concetrated, Age = 0:99, 
 ageMin = 23, ageMax = 77, method = "orig")

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