This function creates a prior distribution for Bayesian audit sampling according to several methods discussed in Derks et al. (2020). The returned object is of class jfaPrior and can be used with associated print() and plot() methods. jfaPrior objects can be used as input for the prior argument in other functions.

For more details on how to use this function see the package vignette: vignette("jfa", package = "jfa")

auditPrior(confidence = 0.95, likelihood = "binomial", method = "none",
expectedError = 0, N = NULL, materiality = NULL, ir = 1, cr = 1,
pHmin = NULL, pHplus = NULL, factor = 1, sampleN = 0, sampleK = 0)

## Arguments

confidence the confidence level desired from the confidence bound (on a scale from 0 to 1). Defaults to 0.95, or 95% confidence. can be one of binomial, poisson, or hypergeometric. See the Details section for more information. the method by which the prior distribution is constructed. Defaults to the none method, which incorporates no prior information. Can be one of none, median, hypotheses, arm, sample or factor. See the Details section for more information. a fraction representing the percentage of expected mistakes in the sample relative to the total size, or a number (>= 1) that represents the number of expected mistakes. the population size (only required when likelihood = 'hypergeometric'). a value between 0 and 1 representing the materiality of the audit as a fraction of the total size or value. Can be NULL for some methods. the inherent risk probability from the audit risk model. Defaults to 1 for 100% risk. the inherent risk probability from the audit risk model. Defaults to 1 for 100% risk. When using method = 'hypotheses', the prior probability of the hypothesis $$\theta <$$ materiality. When using method = 'hypotheses', the prior probability of the hypothesis $$\theta >$$ materiality. When using method = 'factor', the value of the weighting factor for the results of the previous sample. When using method sample or factor, the number of transactions that were inspected in the previous sample. When using method sample or factor, the total taint in the previous sample.

## Value

An object of class jfaPrior containing:

confidence

the method by which the prior distribution is constructed.

likelihood

the likelihood by which the prior distribution is updated.

method

the method by which the prior distribution is constructed.

expectedError

the expected error input.

N

if specified as input, the population size.

materiality

if specified, the materiality that was used to construct the prior distribution.

description

a description of the prior distribution, including parameters and the implicit sample.

statistics

a list of statistics of the prior distribution, including the mean, mode, median, and upper bound.

specifics

a list of optional specifications of the prior distribution, these depend on the method used.

hypotheses

if a materiality is specified, a list of statistics about the hypotheses including prior probabilities and odds.

## Details

This section elaborates on the available likelihoods and corresponding prior distributions for the likelihood argument.

• poisson: The Poisson likelihood is used as a likelihood for monetary unit sampling (MUS). Its likelihood function is defined as: $$p(x) = \frac{\lambda^x e^{-\lambda}}{x!}$$ The conjugate gamma($$\alpha, \beta$$) prior has probability density function: $$f(x; \alpha, \beta) = \frac{\beta^\alpha x^{\alpha - 1} e^{-\beta x}}{\Gamma(\alpha)}$$

• binomial: The binomial likelihood is used as a likelihood for record sampling with replacement. Its likelihood function is defined as: $$p(x) = {n \choose k} p^k (1 - p)^{n - k}$$ The conjugate beta($$\alpha, \beta$$) prior has probability density function: $$f(x; \alpha, \beta) = \frac{1}{B(\alpha, \beta)} x^{\alpha - 1} (1 - x)^{\beta - 1}$$

• hypergeometric: The hypergeometric likelihood is used as a likelihood for record sampling without replacement. Its likelihood function is defined as: $$p(x = k) = \frac{{K \choose k} {N - K \choose n - k}}{{N \choose n}}$$ The conjugate beta-binomial($$\alpha, \beta$$) prior (Dyer and Pierce, 1993) has probability density function: $$f(k | n, \alpha, \beta) = {n \choose k} \frac{B(k + \alpha, n - k + \beta)}{B(\alpha, \beta)}$$

This section elaborates on the available methods for constructing a prior distribution.

• none: This method constructs a prior distribution according to the principle of minimum information.

• median: This method constructs a prior distribution so that the prior probabilities of tolerable and intolerable misstatement are equal.

• hypotheses: This method constructs a prior distribution with specified prior probabilities for the hypotheses of tolerable and intolerable misstatement. Requires specification of the pHmin and pHplus arguments.

• arm: This method constructs a prior distribution according to the assessed risks in the audit risk model. Requires specification of the ir and cr arguments.

• sample: This method constructs a prior distribution on the basis of an earlier sample. Requires specification of the sampleN and sampleK arguments.

• factor: This method constructs a prior distribution on the basis of last year's results and a weighting factor. Requires specification of the factor, sampleN and sampleK arguments.

## References

Derks, K., de Swart, J., Wagenmakers, E.-J., Wille, J., & Wetzels, R. (2019). JASP for audit: Bayesian tools for the auditing practice.

Derks, K., de Swart, J., van Batenburg, P. Wagenmakers, E.-J., & Wetzels, R. (2020). Priors in a Bayesian Audit: How Integrating Information into the Prior Distribution can Improve Audit Transparency and Efficiency.

planning selection evaluation

## Author

Koen Derks, k.derks@nyenrode.nl

## Examples

library(jfa)

# Specify the materiality, confidence, and expected errors:
materiality   <- 0.05   # 5%
confidence    <- 0.95   # 95%
expectedError <- 0.025  # 2.5%

# Specify the inherent risk (ir) and control risk (cr):
ir <- 1     # 100%
cr <- 0.6   # 60%

# Create a beta prior distribution according to the Audit Risk Model (arm)
# and a binomial likelihood:
prior <- auditPrior(confidence = confidence, likelihood = "binomial",
method = "arm", expectedError = expectedError, materiality = materiality,
ir = ir, cr = cr)
print(prior)
#> # ------------------------------------------------------------
#> #         jfa Prior Distribution Summary (Bayesian)
#> # ------------------------------------------------------------
#> # Input:
#> #
#> # Confidence:              95%
#> # Expected sample errors:  2.5%
#> # Likelihood:              binomial
#> # Specifics:               Inherent risk = 1; Internal control risk = 0.6; Detection risk = 0.08
#> # ------------------------------------------------------------
#> # Output:
#> #
#> # Prior distribution:      beta(α = 2.275, β = 50.725)
#> # Implicit sample size:    51
#> # Implicit errors:         1.27
#> # ------------------------------------------------------------
#> # Statistics:
#> #
#> # Upper bound:             0.1
#> # Precision:               0.07
#> # Mode:                    0.02
#> # Mean:                    0.04
#> # Median:                  0.04
#> # ------------------------------------------------------------
# ------------------------------------------------------------
#         jfa Prior Distribution Summary (Bayesian)
# ------------------------------------------------------------
# Input:
#
# Confidence:              0.95
# Expected sample errors:  0.02
# Likelihood:              binomial
# Specifics:               Inherent risk = 1; Internal control risk = 0.6; Detection risk = 0.08
# ------------------------------------------------------------
# Output:
#
# Prior distribution:      beta(2.275, 50.725)
# Implicit sample size:    51
# Implicit errors:         1.27
# ------------------------------------------------------------
# Statistics:
#
# Upper bound:             0.1
# Precision:               7.1%
# Mode:                    0.02
# Mean:                    0.04
# Median:                  0.04
# ------------------------------------------------------------