Learn R Programming

jfa (version 0.1.0)

auditPrior: Create a Prior Distribution

Description

This function creates a prior distribution according to the audit risk model. The returned object is of class jfaPrior and can be used with associated print() and plot() methods. jfaPrior objects can be used as input argument for the prior argument in other functions.

Usage

auditPrior(materiality, confidence = 0.95, method = "arm", ir = 1, cr = 1, 
           expectedError = 0, likelihood = "binomial", N = NULL)

Arguments

materiality

a value between 0 and 1 representing the materiality of the audit as a fraction of the total size or value.

confidence

the confidence level desired from the confidence bound (on a scale from 0 to 1). Defaults to 0.95, or 95% confidence.

method

the method by which the prior distribution is constructed. Currently only supports the arm method, which uses the audit risk model (Derks et al., 2019).

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.

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.

likelihood

can be one of binomial, poisson, or hypergeometric.

N

the population size (required for hypergeometric calculations).

Value

An object of class jfaPrior containing:

method

the method by which the prior distribution is constructed.

likelihood

the likelihood by which the prior distribution is updated.

priorD

the name of the probability density function of the prior distribution.

nPrior

the prior assumed sample size.

kPrior

the prior assumed sample errors

aPrior

the prior parameter alpha.

bPrior

the prior parameter beta.

materiality

the materiality that was used to construct the prior distribution.

N

if specified as input, the population size.

References

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

See Also

planning sampling 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(materiality = materiality, confidence = confidence, 
                    method = "arm", ir = ir, cr = cr, 
                    expectedError = expectedError, likelihood = "binomial")
print(prior)

# jfa prior distribution for arm method:
#      
# Prior sample size:     51 
# Prior errors:          1.27 
# Prior:                 beta(2.275, 50.725)
# }

Run the code above in your browser using DataLab