simulateD: Simulating the Total Error in the Accounts
Description
In a population of accounts each unit has a book value, y, (known)
and a true but unknown value, x. For a random sample of accounts
the true values are observed. Using the posterior from a stepwise
Bayes model this simulates possible values of D, the sum of
the differences between the the book values and the true values.
The 0.95 quantile of this posterior will yield an approximate 95
upper confidence bound for T for most populations and will be less
conservative than the Stringer bound.
Usage
simulateD(ysmp,xsmp,yunsmp ,n,pgt,pwa,R)
Arguments
ysmp
numeric vector of book values for the units in the sample
xsmp
the corresponding true values for the units in the sample
yunsmp
numeric vector of the book values for the units not in
the sample
n
an integer which is the size of the sample
pgt
numeric vector of prior guesses for the taints
pwa
weights corresponding to the taints that appear in the posterior
R
an integer which is the number of simulated values of D returned
Value
A vector of lenght R containing simulated values of D
Details
For a given unit (y-x)/x is its taint. pgt is a prior guess for the
possible taints in the population. pwt specifies how much weight
the prior guess pgt should have in the posterior. When all the taints
are assumed to be nonnegative then the Stringer bound is often
used. Setting both pqt and pwt equal to one yields a slightly shorter
bound than that of Stringer's.
References
Meeden, G. and Sargent, D. (2007)
Some Bayesian methods for two auditing problems.
Communications in Statistics --- Theory and Methods,
36, 2727--2740.
10.1080/03610920701386802.
# NOT RUN {y <- rgamma(500,5)
x <- y
dum <- sample(1:500,50)
x[dum] <- x[dum]*runif(50,.05,0.5)
smp <- sample(1:500,40)
quantile(simulateD(y[smp],x[smp],y[-smp],40,1,1,1000),0.95)
# }