planning {jfa} | R Documentation |
Audit Sampling: Planning
Description
planning()
is used to calculate a minimum sample size for
audit samples. It allows specification of statistical requirements for the
sample with respect to the performance materiality or the precision. The
function returns an object of class jfaPlanning
that can be used with
associated summary()
and plot()
methods.
Usage
planning(
materiality = NULL,
min.precision = NULL,
expected = 0,
likelihood = c("poisson", "binomial", "hypergeometric"),
conf.level = 0.95,
N.units = NULL,
by = 1,
max = 5000,
prior = FALSE
)
Arguments
materiality |
a numeric value between 0 and 1 specifying the
performance materiality (i.e., the maximum tolerable misstatement in the
population) as a fraction. Can be |
min.precision |
a numeric value between 0 and 1 specifying the minimum
precision (i.e., the estimated upper bound minus the estimated most likely
error) as a fraction. Can be |
expected |
a numeric value between 0 and 1 specifying the expected
(tolerable) misstatements in the sample relative to the total sample size,
or a number (>= 1) specifying the expected (tolerable) number of
misstatements in the sample. It is advised to set this value conservatively
to minimize the probability of the observed misstatements in the sample
exceeding the expected misstatements, which would imply that insufficient
work has been done in the end and that additional samples are required.
This argument also facilitates sequential sampling plans since it can also
be a vector (e.g., |
likelihood |
a character specifying the likelihood of the data.
Possible options are |
conf.level |
a numeric value between 0 and 1 specifying the confidence level (i.e., 1 - audit risk / detection risk). |
N.units |
a numeric value larger than 0 specifying the total
number of units in the population. Required for the |
by |
an integer larger than 0 specifying the increment
between acceptable sample sizes (e.g., |
max |
an integer larger than 0 specifying the sample size at
which the algorithm terminates (e.g., |
prior |
a logical specifying whether to use a prior distribution,
or an object of class |
Details
This section elaborates on the available input options for the
likelihood
argument and the corresponding conjugate prior
distributions used by jfa
.
poisson
: The Poisson distribution is an approximation of the binomial distribution. The Poisson distribution is defined as:f(\theta, n) = \frac{\lambda^\theta e^{-\lambda}}{\theta!}
. The conjugate gamma(
\alpha, \beta
) prior has probability density function:p(\theta; \alpha, \beta) = \frac{\beta^\alpha \theta^{\alpha - 1} e^{-\beta \theta}}{\Gamma(\alpha)}
.
binomial
: The binomial distribution is an approximation of the hypergeometric distribution. The binomial distribution is defined as:f(\theta, n, x) = {n \choose x} \theta^x (1 - \theta)^{n - x}
. The conjugate beta(
\alpha, \beta
) prior has probability density function:p(\theta; \alpha, \beta) = \frac{1}{B(\alpha, \beta)} \theta^{\alpha - 1} (1 - \theta)^{\beta - 1}
.
hypergeometric
: The hypergeometric distribution is defined as:f(x, n, K, N) = \frac{{K \choose x} {N - K \choose n - x}} {{N \choose n}}
. The conjugate beta-binomial(
\alpha, \beta
) prior (Dyer and Pierce, 1993) has probability mass function:f(x, n, \alpha, \beta) = {n \choose x} \frac{B(x + \alpha, n - x + \beta)}{B(\alpha, \beta)}
.
Value
An object of class jfaPlanning
containing:
conf.level |
a numeric value between 0 and 1 giving the confidence level. |
x |
a numeric value larger than, or equal to, 0 giving (the proportional sum of) the tolerable errors in the sample. |
n |
an integer larger than 0 giving the minimum sample size. |
n_staged |
in the case of a multi-stage sampling plan, an integer larger than 0 giving the minimum sample size per stage. |
ub |
a numeric value between 0 and 1 giving the expected upper bound. |
precision |
a numeric value between 0 and 1 giving the expected precision. |
p.value |
a numeric value giving the expected one-sided p-value. |
K |
if |
N.units |
an integer larger than 0 giving the number of units in the
population (only returned if |
materiality |
a numeric value between 0 and 1 giving the performance materiality if specified. |
min.precision |
a numeric value between 0 and 1 giving the minimum precision if specified. |
expected |
a numeric value larger than, or equal to, 0 giving the expected misstatement input. |
likelihood |
a character indicating the likelihood. |
errorType |
a character indicating the expected misstatements input. |
iterations |
an integer giving the number of iterations of the algorithm. |
prior |
if a prior distribution is specified, an object of class
|
posterior |
if a prior distribution is specified, an object of class
|
Author(s)
Koen Derks, k.derks@nyenrode.nl
References
Derks, K., de Swart, J., van Batenburg, P., Wagenmakers, E.-J., & Wetzels, R. (2021). Priors in a Bayesian audit: How integration of existing information into the prior distribution can improve audit transparency and efficiency. International Journal of Auditing, 25(3), 621-636. doi:10.1111/ijau.12240
Derks, K., de Swart, J., Wagenmakers, E.-J., Wille, J., & Wetzels, R. (2021). JASP for audit: Bayesian tools for the auditing practice. Journal of Open Source Software, 6(68), 2733. doi:10.21105/joss.02733
Dyer, D. and Pierce, R.L. (1993). On the choice of the prior distribution in hypergeometric sampling. Communications in Statistics - Theory and Methods, 22(8), 2125-2146. doi:10.1080/03610929308831139
See Also
auditPrior
selection
evaluation
Examples
# Classical planning
planning(materiality = 0.03, expected = 0)
# Classical two-stage planning
planning(materiality = 0.03, expected = c(1, 0))
# Bayesian planning using a default prior
planning(materiality = 0.03, prior = TRUE)
# Bayesian planning using a custom prior
prior <- auditPrior(method = "impartial", materiality = 0.05)
planning(materiality = 0.05, prior = prior)