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.

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 NULL, but min.precision should be specified in that case.

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 NULL, but materiality should be specified in that case.

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., c(1, 0)) of tolerable misstatements in each stage of the audit sample. Hence, c(1, 0) gives the sample size for a sequential sampling plan in which the auditor can stop after seeing 0 misstatements in the first sample, but can extend the sample if more than 0 misstatements are found.

likelihood

a character specifying the likelihood of the data. Possible options are poisson (default) for the Poisson likelihood, binomial for the binomial likelihood, or hypergeometric for the hypergeometric likelihood. See the details section for more information about the possible likelihoods.

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 hypergeometric likelihood.

by

an integer larger than 0 specifying the increment between acceptable sample sizes (e.g., increment = 5 considers only sample sizes of 5, 10, 15, ...).

max

an integer larger than 0 specifying the sample size at which the algorithm terminates (e.g., max = 100 will terminate the algorithm at n = 100).

prior

a logical specifying whether to use a prior distribution, or an object of class jfaPrior or jfaPosterior. If this argument is specified as FALSE (default), the function performs classical planning. If this argument is specified as TRUE or as a prior from auditPrior, this function performs Bayesian planning using a prior that is conjugate to the specified likelihood.

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 likelihood = 'hypergeometric', an integer larger than 0 giving the assumed population errors.

N.units

an integer larger than 0 giving the number of units in the population (only returned if N.units is specified).

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 jfaPrior that contains information about the prior distribution.

posterior

if a prior distribution is specified, an object of class jfaPosterior that contains information about the expected posterior distribution.

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)}$$.

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

Author

Koen Derks, k.derks@nyenrode.nl

Examples

# Classical planning
planning(materiality = 0.03, expected = 0)
#> 
#> 	Classical Audit Sample Planning
#> 
#> minimum sample size = 100 
#> sample size obtained in 101 iterations via method 'poisson'

# Classical two-stage planning
planning(materiality = 0.03, expected = c(1, 0))
#> 
#> 	Classical Audit Sample Planning
#> 
#> minimum sample size = 210 (105 per stage) 
#> sample size obtained in 104 iterations via method 'poisson' + 'sequential'

# Bayesian planning using a default prior
planning(materiality = 0.03, prior = TRUE)
#> 
#> 	Bayesian Audit Sample Planning
#> 
#> minimum sample size = 99 
#> sample size obtained in 100 iterations via method 'poisson' + 'prior'

# Bayesian planning using a custom prior
prior <- auditPrior(method = "impartial", materiality = 0.05)
planning(materiality = 0.05, prior = prior)
#> 
#> 	Bayesian Audit Sample Planning
#> 
#> minimum sample size = 47 
#> sample size obtained in 48 iterations via method 'poisson' + 'prior'