Simulating D with Stringer-like stepwise Bayes posteriors

General Instructions

Below we have create a population of 500 items with book values y and true values x. Here K=50 of the items are in error and all the errors are positive. This example was chosen only because it was convenient and is not assumed to be realistic. Note also that the sample uses simple random sampling to select the units not Dollar Unit Sampling. It finds the value of D = sum(y - x), the 0.95 quantile of the simulated values. To do the example, just click the "Submit" button. However you can edit the lines of code to create your own populations and calculate other statistics of the set of simulated values.

Arguments for the function

simulateD(ysmp, xsmp, yunsmp, n, tbds, avls, R1)

Note simulateD(ysmp, xsmp, yunsmp, n, tbds, avls, R1) returns a vector of length R1 containing the simulated values of D.

If the population has both positive and negative errors then tbds = (t1,t2) and avls = (a1,a2) are both vectors of length two. Often avls = (1,1) is a good choice. Then one must select t1 in (0,1] and t2 < 0 to reflect prior information information about the population. In some cases t1 = 1 can be a sensible choice but there is no default setting for t2.

For more discussion on this method see a PostScript version of the technical report A stepwise Bayes justification for some Stringer type bounds in auditing problems