Skip to contents

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')

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) as a fraction of the total number of units in the population. 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., upper bound minus most likely error) as a fraction of the total population size. Can be NULL, but materiality should be specified in that case.

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 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 available likelihoods.

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

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 jfaPrior or jfaPosterior. If FALSE (default), performs classical planning. If TRUE, performs Bayesian planning using a default conjugate prior.

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

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.

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.

Author

Koen Derks, k.derks@nyenrode.nl

Examples

# Classical planning using a Poisson likelihood
planning(materiality = 0.03, expected = 0.01, likelihood = "poisson")
#> 
#> 	Classical Audit Sample Planning
#> 
#> minimum sample size = 220 
#> sample size obtained in 221 iteration(s) via method 'poisson'

# Bayesian planning using a noninformative beta prior distribution
planning(
  materiality = 0.05, expected = 0.025, likelihood = "binomial",
  prior = TRUE
)
#> 
#> 	Bayesian Audit Sample Planning
#> 
#> minimum sample size = 220 
#> sample size obtained in 221 iteration(s) via method 'binomial' + 'prior'

# Bayesian planning using an impartial gamma prior distribution
planning(
  materiality = 0.05, expected = 0, likelihood = "poisson",
  prior = auditPrior(method = "impartial", materiality = 0.05)
)
#> 
#> 	Bayesian Audit Sample Planning
#> 
#> minimum sample size = 47 
#> sample size obtained in 48 iteration(s) via method 'poisson' + 'prior'