Considered a stratified finite population of accounts where each account is classified as either acceptable or in error. Based on a stratified random sample of accounts an auditor is required to give an upper 95% confidence bound for the total number of units, T, in the population that are in error. Given the sample this uses the posterior distribution from a simple hierarchical Bayes model to simulate possible values for T. The 0.95 quantile for this posterior will be an approximate 95% upper confidence bound for T for most populations. To do the example, just click the "Submit" button. However you can edit the lines of code to get results for other examples.
simulateT(smp,n,N,grd,R)
N is the vector defining the strata sizes of the population.
n is the vector of sample sizes taken from the strata.
smp is the vector of the number of accounts in error in each strata of
the population.
grd is a sequence of nonnegative numbers which defines the Bayesian model.
R is the number of simulated copies of the total number of accounts,
T , in error generated by the posterior.
Note simulateT(smp,n,N,grd,R) returns a vector of length R containing
the simulated values of T.
For more discussion on this method see a PostScript version of the technical report Inference for a stratified finite population with a dichotomous characteristic