planning {jfa} | R Documentation |
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. planning()
returns an object of class jfaPlanning
which can be used with associated summary()
and plot()
methods.
For more details on how to use this function, see the package vignette:
vignette('jfa', package = 'jfa')
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)
materiality |
a numeric value between 0 and 1 specifying the performance materiality (i.e., the maximum tolerable misstatement) as a fraction of the total number of units in the population. Can be |
min.precision |
a numeric value between 0 and 1 specifying the minimum precision (i.e., upper bound minus most likely error) as a fraction of the total population size. Can be |
expected |
a numeric value between 0 and 1 specifying the expected / tolerable errors in the sample relative to the total sample size, or a number (>= 1) specifying the expected / tolerable number of errors in the sample. It is advised to set this value conservatively to minimize the probability of the observed errors exceeding the expected errors, which would imply that insufficient work has been done in the end. |
likelihood |
a character specifying the likelihood for the data. Possible options are |
conf.level |
a numeric value between 0 and 1 specifying the confidence level. |
N.units |
a numeric value larger than 0 specifying the total number of units in the population. Only used for the |
by |
an integer larger than 0 specifying the increment between possible sample sizes. |
max |
an integer larger than 0 specifying the sample size at which the algorithm terminates. |
prior |
a logical specifying whether to use a prior distribution, or an object of class |
This section elaborates on the available likelihoods and corresponding prior distributions for the likelihood
argument.
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)}
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 minimal sample size. |
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 errors input. |
likelihood |
a character indicating the likelihood. |
errorType |
a character indicating whether the expected errors input type. |
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 |
Koen Derks, k.derks@nyenrode.nl
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.
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.
auditPrior
selection
evaluation
report
# Classical planning using a Poisson likelihood
planning(materiality = 0.03, expected = 0.01, likelihood = "poisson")
# Bayesian planning using a noninformative beta prior distribution
planning(
materiality = 0.05, expected = 0.025, likelihood = "binomial",
prior = TRUE
)
# Bayesian planning using an impartial gamma prior distribution
planning(
materiality = 0.05, expected = 0, likelihood = "poisson",
prior = auditPrior(method = "impartial", materiality = 0.05)
)