Simulating the Total Number of Accounts in Error

General Instructions

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.

Arguments for the function

simulateT(smp,n,N,grd,R)

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