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.

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. numeric. A vector of ages corresponding to the lower integer bound of the counts. the minimum age used for estimation, default 23 the maximum age used for estimation, default 77 either "orig" or "pasex" logical. Should a list of output be given logical. Is the highest age group open?

## Value

The value of the index.

## 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.

United States Census Bureau (2017). “Population Analysis System (PAS) Software.” https://www.census.gov/data/software/pas.html, https://www.census.gov/data/software/pas.html. Bachi R (1951). “The tendency to round off age returns: measurement and correction.” Bulletin of the International Statistical Institute, 33(4), 195--222. Shryock HS, Siegel JS, Larmon EA (1973). The methods and materials of demography. US Bureau of the Census.

## Examples

 check_heaping_bachi(pop1m_pasex, Age = 0:99,
ageMin = 23, ageMax = 77, method = "orig", OAG =FALSE)
#>  28.93849
check_heaping_bachi(pop1m_ind, Age = 0:100,
ageMin = 23, ageMax = 77, method = "orig")
#>  41.2661
# default simpler
check_heaping_bachi(pop1m_pasex, Age = 0:99,
ageMin = 23, ageMax = 77, method = "pasex", OAG = FALSE)
#>  28.96891
# 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)
#>  0
# 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")
#>  90
check_heaping_bachi(pop_concetrated, Age = 0:99,
ageMin = 23, ageMax = 77, method = "orig")
#>  90