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.
simulateD(ysmp, xsmp, yunsmp, n, tbds, avls, R1)
ysmp is the observed y or book values.
xsmp is the observed x or true values.
yunsmp is the unobserved y or remaining book values
in the population.
n is the sample size.
tbds are the bounds for the taints with the upper bound for the positive
taints coming first and the lower bound for the negative taints coming second if included. avls are the exponents of terms in the posterior associated with the special categories in tbds.
R1 is the number of simulated copies of D that are
generated.
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