`auditPrior()`

is used to create a prior distribution for
Bayesian audit sampling. The interface allows a complete customization of the
prior distribution as well as a formal translation of pre-existing audit
information into a prior distribution. The function returns an object of
class `jfaPrior`

that can be used in the `planning()`

and
`evaluation()`

functions via their `prior`

argument. Objects with
class `jfaPrior`

can be further inspected via associated
`summary()`

and `plot()`

methods.

```
auditPrior(
method = c(
"default", "param", "strict", "impartial", "hyp",
"arm", "bram", "sample", "power", "nonparam"
),
likelihood = c(
"poisson", "binomial", "hypergeometric",
"normal", "uniform", "cauchy", "t", "chisq",
"exponential"
),
N.units = NULL,
alpha = NULL,
beta = NULL,
materiality = NULL,
expected = 0,
ir = NULL,
cr = NULL,
ub = NULL,
p.hmin = NULL,
x = NULL,
n = NULL,
delta = NULL,
samples = NULL,
conf.level = 0.95
)
```

- method
a character specifying the method by which the prior distribution is constructed. Possible options are

`default`

,`strict`

,`impartial`

,`param`

,`arm`

,`bram`

,`hyp`

,`sample`

, and`power`

. See the details section for more information.- likelihood
a character specifying the likelihood for updating the prior distribution. Possible options are

`poisson`

(default) for a conjugate gamma prior distribution,`binomial`

for a conjugate beta prior distribution, or`hypergeometric`

for a conjugate beta-binomial prior distribution. See the details section for more information.- N.units
a numeric value larger than 0 specifying the total number of units in the population. Required for the

`hypergeometric`

likelihood.- alpha
a numeric value specifying the \(\alpha\) parameter of the prior distribution. Required for method

`param`

.- beta
a numeric value specifying the \(\beta\) parameter of the prior distribution. Required for method

`param`

.- materiality
a numeric value between 0 and 1 specifying the performance materiality (i.e., the maximum tolerable misstatement in the population) as a fraction. Required for methods

`impartial`

,`arm`

, and`hyp`

.- expected
a numeric value between 0 and 1 specifying the expected (tolerable) misstatements in the sample relative to the total sample size. Required for methods

`impartial`

,`arm`

,`bram`

, and`hyp`

.- ir
a numeric value between 0 and 1 specifying the inherent risk (i.e., the probability of material misstatement occurring due to inherent factors) in the audit risk model. Required for method

`arm`

.- cr
a numeric value between 0 and 1 specifying the internal control risk (i.e., the probability of material misstatement occurring due to internal control systems) in the audit risk model. Required for method

`arm`

.- ub
a numeric value between 0 and 1 specifying the

`conf.level`

-% upper bound for the prior distribution as a fraction. Required for method`bram`

.- p.hmin
a numeric value between 0 and 1 specifying the prior probability of the hypothesis of tolerable misstatement (H1: \(\theta <\) materiality). Required for method

`hyp`

.- x
a numeric value larger than, or equal to, 0 specifying the sum of proportional misstatements (taints) in a prior sample. Required for methods

`sample`

and`power`

.- n
a numeric value larger than 0 specifying the number of units in a prior sample. Required for methods

`sample`

and`power`

.- delta
a numeric value between 0 and 1 specifying the weight of a prior sample specified via

`x`

and`n`

. Required for method`power`

.- samples
a numeric vector containing samples of the prior distribution. Required for method

`nonparam`

.- conf.level
a numeric value between 0 and 1 specifying the confidence level (1 - audit risk).

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 likelihood of the data.

- materiality
if

`materiality`

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

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

- N.units
if

`N.units`

is specified, the number of units in the population.

To perform Bayesian audit sampling you must assign a prior
distribution to the parameter in the model, i.e., the population
misstatement \(\theta\). The prior distribution can incorporate
pre-existing audit information about \(\theta\) into the analysis, which
consequently allows for a more efficient or more accurate estimates. The
default priors used by `jfa`

are indifferent towards the possible
values of \(\theta\), while still being proper. Note that the default
prior distributions are a conservative choice of prior since they, in most
cases, assume all possible misstatement to be equally likely before seeing
a data sample. It is recommended to construct an informed prior
distribution based on pre-existing audit information when possible.

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

argument.

`default`

: This method produces a*gamma(1, 1)*,*beta(1, 1)*,*beta-binomial(N, 1, 1)*,*normal(0.5, 1000)*,*cauchy(0, 1000)*,*student-t(1)*, or*chi-squared(1)*prior distribution. These prior distributions are mostly indifferent about the possible values of the misstatement.`param`

: This method produces a custom`gamma(alpha, beta)`

,`beta(alpha, beta)`

,`beta-binomial(N, alpha, beta)`

prior distribution,*normal(alpha, beta)*,*cauchy(alpha, beta)*,*student-t(alpha)*, or*chi-squared(alpha)*. The alpha and beta parameters must be set using`alpha`

and`beta`

.`strict`

: This method produces an improper*gamma(1, 0)*,*beta(1, 0)*, or*beta-binomial(N, 1, 0)*prior distribution. These prior distributions match sample sizes and upper limits from classical methods and can be used to emulate classical results.`impartial`

: This method produces an impartial prior distribution. These prior distributions assume that tolerable misstatement (\(\theta <\) materiality) and intolerable misstatement (\(\theta >\) materiality) are equally likely.`hyp`

: This method translates an assessment of the prior probability for tolerable misstatement (\(\theta <\) materiality) to a prior distribution.`arm`

: This method translates an assessment of inherent risk and internal control risk to a prior distribution.`bram`

: This method translates an assessment of the expected most likely error and*x*-% upper bound to a prior distribution.`sample`

: This method translates the outcome of an earlier sample to a prior distribution.`power`

: This method translates and weighs the outcome of an earlier sample to a prior distribution (i.e., a power prior).`nonparam`

: This method takes a vector of samples from the prior distribution (via`samples`

) and constructs a bounded density (between 0 and 1) on the basis of these samples to act as the prior.

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

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

Derks, K., de Swart, J., Wagenmakers, E.-J., & Wetzels, R.
(2022). An impartial Bayesian hypothesis test for audit sampling.
*PsyArXiv*. doi:10.31234/osf.io/8nf3e

```
# Default beta prior
auditPrior(likelihood = "binomial")
#>
#> Prior Distribution for Audit Sampling
#>
#> functional form: beta(α = 1, β = 1)
#> parameters obtained via method 'default'
# Impartial prior
auditPrior(method = "impartial", materiality = 0.05)
#>
#> Prior Distribution for Audit Sampling
#>
#> functional form: gamma(α = 1, β = 13.863)
#> parameters obtained via method 'impartial'
# Non-conjugate prior
auditPrior(method = "param", likelihood = "normal", alpha = 0, beta = 0.1)
#>
#> Prior Distribution for Audit Sampling
#>
#> functional form: normal(μ = 0, σ = 0.1)T[0,1]
#> parameters obtained via method 'param'
```