Learn R Programming

jfa (version 0.5.7)

auditBF: Function to compute Bayes factors for audit sampling

Description

This function computes Bayes factors for audit sampling from summary statistics of an audit sample. By default, the Bayes factor is computed using an impartial prior distribution on the misstatement (Derks et al., 2021). However, the arguments nPrior and kPrior can be used to specify an alternative prior distribution (Derks et al., 2021).

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

Usage

auditBF(materiality, n, k, expectedError = 0, likelihood = 'binomial', 
        nPrior = NULL, kPrior = NULL, N = NULL, log = FALSE)

Arguments

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.

n

an integer larger than 0 specifying the number of items in the sample.

k

a number larger than zero specifying the observed proportional error (i.e., sum of taints) in the sample.

expectedError

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.

likelihood

a character specifying the likelihood assumed when updating the prior distribution. This can be either binomial for the binomial likelihood and beta prior distribution, poisson for the Poisson likelihood and gamma prior distribution, or hypergeometric for the hypergeometric likelihood and beta-binomial prior distribution. See the details section for more information about the available likelihoods.

nPrior

numeric value larger than, or equal to, 0 specifying the sample size of the sample equivalent to the prior information.

kPrior

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

N

an integer larger than 0 specifying the total population size. Only required when likelihood = 'hypergeometric'.

log

logical; if TRUE, the Bayes factor is given as log(bf).

Value

A value for the Bayes factor in favor of the hypothesis of tolerable misstatement against the hypothesis of intolerable misstatement.

Details

The Bayes Factor \(BF_{-+}\) quantifies how much more likely the data are to be observed under \(H_{-}: \theta < \theta_{max}\) than under \(H_{+}: \theta > \theta_{max}\). Therefore, \(BF_{-+}\) can be interpreted as the relative support in the observed data for \(H_{-}\) versus \(H_{+}\). If \(BF_{-+}\) is 1, there is no preference for either \(H_{-}\) or \(H_{+}\). If \(BF_{-+}\) is larger than 1, \(H_{-}\) is preferred. If \(BF_{-+}\) is between 0 and 1, \(H_{+}\) is preferred.

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

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

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

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

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, 1-16.

See Also

auditPrior planning selection evaluation report

Examples

Run this code
# NOT RUN {
 
# Compute a default Bayes factor from an impartial prior
auditBF(materiality = 0.05, n = 50, k = 1)

# Compute a Bayes factor from a negligible prior
auditBF(materiality = 0.05, n = 50, k = 1, nPrior = 0, kPrior = 0)

# }

Run the code above in your browser using DataLab