Learn R Programming

jfa (version 0.4.0)

auditPrior: Create a Prior Distribution with Existing Audit Information

Description

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.

Usage

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.

likelihood

can be one of binomial, poisson, or hypergeometric. See the Details section for more information.

method

the method by which the prior distribution is constructed. Defaults to the arm method, which uses the audit risk model (Derks et al., 2019). Can be one of none, median, hypotheses, arm, sample or factor. See the Details section for more information.

expectedError

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.

N

the population size (only required when likelihood = 'hypergeometric').

materiality

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.

ir

the inherent risk probability from the audit risk model. Defaults to 1 for 100% risk.

cr

the inherent risk probability from the audit risk model. Defaults to 1 for 100% risk.

pHmin

When using method = 'hypotheses', the prior probability of the hypothesis \(\theta <\) materiality.

pHplus

When using method = 'hypotheses', the prior probability of the hypothesis \(\theta >\) materiality.

factor

When using method = 'factor', the value of the weighting factor for the results of the previous sample.

sampleN

When using method sample or factor, the number of transactions that were inspected in the previous sample.

sampleK

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 methods for constructing a prior distribution.

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

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

See Also

planning selection evaluation

Examples

Run this code
# NOT RUN {
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:              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 
# ------------------------------------------------------------
# }

Run the code above in your browser using DataLab