This function creates a prior distribution for the misstatement parameter \(\theta\) in an audit sampling model. The prior can be used in the `planning()`

and `evaluation()`

functions via their `prior`

argument. The function returns an object of class `jfaPrior`

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

```
auditPrior(method = 'default', likelihood = c('poisson', 'binomial', 'hypergeometric'),
N.units = NULL, alpha = NULL, beta = NULL, materiality = NULL, expected = 0,
ir = NULL, cr = NULL, ub = NULL, p.hmin = NULL, x = NULL,
n = NULL, factor = NULL, conf.level = 0.95)
```

- method
a character specifying the method by which the prior distribution is constructed. Defaults to

`default`

which incorporates no existing information. Other options are`strict`

,`arm`

,`bram`

,`impartial`

,`hyp`

,`sample`

, and`factor`

. See the details section for more information about the available methods.- likelihood
a character specifying the likelihood assumed when updating the prior distribution. This can be either

`poisson`

(default) for the Poisson likelihood and gamma prior distribution,`biomial`

for the binomial likelihood and beta prior distribution, or`hypergeometric`

for the hypergeometric likelihood and beta-binomial prior distribution. See the details section for more information about the available likelihoods.- N.units
an numeric value larger than 0 specifying the total number of units in the population. Optional unless

`likelihood = 'hypergeometric'`

.- alpha
if

`method = 'param'`

, a numeric value specifying the \(\alpha\) parameter of the prior distribution.- beta
if

`method = 'param'`

, a numeric value specifying the \(\beta\) parameter of the prior distribution.- materiality
a numeric value between 0 and 1 specifying the performance materiality (i.e., the maximum upper limit) as a fraction of the total population size. Can be

`NULL`

for some methods.- expected
a numeric value between 0 and 1 specifying the expected errors in the sample relative to the total sample size, or a numeric value (>= 1) that represents the sum of expected 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.

- ir
if

`method = 'arm'`

, a numeric value between 0 and 1 specifying the inherent risk in the audit risk model. Defaults to 1 for 100% risk.- cr
if

`method = 'arm'`

, a numeric value between 0 and 1 specifying the internal control risk in the audit risk model. Defaults to 1 for 100% risk.- ub
if

`method = 'bram'`

, a numeric value between 0 and 1 specifying the upper bound for the prior distribution as a fraction of the population size.- p.hmin
if

`method = 'hyp'`

, a numeric value between 0 and 1 specifying the prior probability of the hypothesis of tolerable misstatement (H1: \(\theta <\) materiality).- x
if

`method = 'sample'`

or`method = 'factor'`

, a numeric value larger than, or equal to, 0 specifying the sum of errors in the sample equivalent to the prior information.- n
if

`method = 'sample'`

or`method = 'factor'`

, an integer larger than, or equal to, 0 specifying the sample size of the sample equivalent to the prior information.- factor
if

`method = 'factor'`

, a numeric value between 0 and 1 specifying the weighting factor for the results of the sample equivalent to the prior information.- conf.level
a numeric value between 0 and 1 specifying the confidence level to be used in the planning. Defaults to 0.95 for 95% confidence. Used to calculate the upper bound of the prior distribution.

An object of class `jfaPrior`

containing:

- prior
a string describing the functional form of the prior distribution.

- description
a list containing a description of the prior distribution, including the parameters of the prior distribution and the implicit sample on which the prior distribution is based.

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

- specifics
a list containing specifics of the prior distribution that vary depending on the

`method`

.- hypotheses
if

`materiality`

is specified, a list containing information about the hypotheses, including prior probabilities and odds for the hypothesis of tolerable misstatement (H1) and the hypothesis of intolerable misstatement (H0).- method
a character indicating the method by which the prior distribution is constructed.

- likelihood
a character indicating the assumed likelihood.

- materiality
if

`materiality`

is specified, a numeric value between 0 and 1 indicating the materiality used to construct the prior distribution.- expected
a numeric value larger than, or equal to, 0 indicating the input for the number of expected errors.

- conf.level
a numeric value between 0 and 1 indicating the confidence level used.

- N.units
if

`N`

is specified, an integer larger than 0 indicating the population size.

`auditPrior`

is used to define prior distributions for parameters in `jfa`

models. To perform Bayesian audit sampling, you must assign a prior distribution to the misstatement parameter \(\theta\).
The prior is a probability distribution that reflects the existing information about the parameter before seeing a sample. To keep the priors proper, the `default`

priors used by `jfa`

are indifferent as much as possible,
meaning they contain minimal prior information. However, it is strongly recommended to use an informed prior distribution when possible.

This section elaborates on the available options for the `method`

argument.

`default`

: This method produces*gamma(1, 1)*,*beta(1, 1)*, and*beta-binomial(N, 1, 1)*prior distributions which incorporate minimal information about the possible values of the misstatement.`strict`

: This method produces*gamma(1, 0)*,*beta(1, 0)*, and*beta-binomial(N, 1, 0)*prior distributions. Note that these prior distributions are improper and yield the same sample sizes and upper limits as classical techniques.`param`

: This method constructs a prior distribution on the basis of manually specified \(\alpha\) and \(\beta\) parameters.`impartial`

: This method constructs a prior distribution under which the prior probability of tolerable misstatement (\(\theta <\) materiality) is equal to the prior probability of intolerable misstatement (\(\theta >\) materiality).`hyp`

: This method constructs a prior distribution with manual prior probabilities for the hypotheses of tolerable misstatement (\(\theta <\) materiality) and intolerable misstatement (\(\theta >\) materiality). This method requires specification of the`p.hmin`

argument.`arm`

: This method constructs a prior distribution by translating the risks of material misstatement (inherent risk and internal control risk) from the audit risk model to an implicit sample. The method requires specification of the`ir`

(inherent risk) and`cr`

(internal control risk) arguments.`bram`

: This method constructs a prior distribution using the Bayesian audit risk assessment model (BRAM) in which the expected most likely error and expected upper bound of the misstatement must be specified. The method requires specification of the`ub`

argument.`sample`

: This method constructs a prior distribution on the basis of an earlier observed sample. This method requires specification of the`n`

and`x`

arguments.`factor`

: This method constructs a prior distribution on the basis of an earlier sample in combination with a weighting factor. This method requires specification of the`n`

,`x`

, and`factor`

arguments.

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

argument.

`poisson`

: The Poisson likelihood is often used as a likelihood for monetary unit sampling (MUS). The 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 often used as a likelihood for attributes sampling*with*replacement. The 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 sampling*without*replacement. The 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)}$$

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. (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.

```
# Translate inherent risk (ir) and control risk (cr) to a prior distribution
auditPrior(
method = "arm", likelihood = "poisson", expected = 0.025,
materiality = 0.05, ir = 1, cr = 0.6
)
#>
#> Prior Distribution for Audit Sampling
#>
#> functional form: gamma(α = 2.325, β = 53)
#> parameters obtained via method 'arm'
# Equal prior probabilities
auditPrior(method = "impartial", likelihood = "poisson", materiality = 0.05)
#>
#> Prior Distribution for Audit Sampling
#>
#> functional form: gamma(α = 1, β = 13.863)
#> parameters obtained via method 'impartial'
# Custom prior distribution
auditPrior(method = "param", likelihood = "poisson", alpha = 1, beta = 10)
#>
#> Prior Distribution for Audit Sampling
#>
#> functional form: gamma(α = 1, β = 10)
#> parameters obtained via method 'param'
```