# Prior distributions

## Bayesian statistics

Bayesian statistics allows you to incorporate existing information into the sampling procedure and to revise this information using the information from the sample. The use of the prior distribution can potentially decrease the amount of audit work required to achieve the desired assurance, thereby increasing your efficiency as an auditor. For example, when you have information from the auditee’s internal controls that indicates a low-risk profile, you may build on this information to require less evidence from substantive testing. Be aware that all information that you incorporate into the statistical analysis should be justified.

### Prior probability distributions

Bayesian statistics incorporates existing information into the sampling procedure using a prior probability distribution. The prior distribution is a probability distribution that reflects your existing information about the misstatement in the population. Because the prior distribution is based on existing information, it is usually created before the auditor starts planning a sample.

## Constructing a prior distribution

What information can be incorporated into the prior distribution depends on what type of information is available, the quality of that information, and the situation at hand. When the auditor has decided what kind of information they want to incorporate into a prior distribution, they can use the auditPrior() function to calculate the corresponding parameters of the prior distribution. Below we discuss the various types of audit information that jfa is able to incorporate into a prior distribution.

First, we set some default options for the confidence, performance materiality, the likelihood, and the expected errors in the sample.

confidence    <- 0.95       # 95% confidence
likelihood    <- 'binomial' # Binomial likelihood
materiality   <- 0.05       # Performance materiality of 5%
expectedError <- 0.01       # 1% errors expected in sample

### [Default] No explicit information (method = 'none')

You can refrain from incorporating explicit information in the prior distribution using method = 'none'. As an example, the code below incorporates no explicit information into a prior distribution

prior1 <- auditPrior(method = 'none', likelihood = likelihood,
expectedError = expectedError, confidence = confidence)
summary(prior1)
## # ------------------------------------------------------------
## #         jfa Prior Distribution Summary (Bayesian)
## # ------------------------------------------------------------
## # Input:
## #
## # Confidence:                    95%
## # Expected sample errors:        1%
## # Likelihood:                    binomial
## # Specifics:                     None
## # ------------------------------------------------------------
## # Output:
## #
## # Prior distribution:            beta(a = 1, ß = 1)
## # Implicit sample size:          0
## # Implicit errors:               0
## # ------------------------------------------------------------
## # Statistics:
## #
## # Upper bound:                   0.95
## # Precision:                     NaN
## # Mode:                          NaN
## # Mean:                          0.5
## # Median:                        0.5
## # ------------------------------------------------------------

You can visually inspect the prior distribution using the plot() function.

plot(prior1)

### Audit Risk Model (method = 'arm')

You can translate the risk assessments from the Audit Risk Model (inherent risk and internal control risk) into a prior distribution using method = 'arm' in combination with the ir and cr arguments. As an example, the code below incorporates the information that the inherent risk is equal to 90% and that the internal control risk is equal to 60% into a prior distribution.

prior2 <- auditPrior(method = 'arm', likelihood = likelihood,
expectedError = expectedError, confidence = confidence,
materiality = materiality, ir = 0.9, cr = 0.6)
summary(prior2)
## # ------------------------------------------------------------
## #         jfa Prior Distribution Summary (Bayesian)
## # ------------------------------------------------------------
## # Input:
## #
## # Confidence:                    95%
## # Expected sample errors:        1%
## # Likelihood:                    binomial
## # Specifics:                     IR = 0.9; ICR = 0.6; DR = 0.093
## # ------------------------------------------------------------
## # Output:
## #
## # Prior distribution:            beta(a = 1.21, ß = 21.79)
## # Implicit sample size:          21
## # Implicit errors:               0.21
## # ------------------------------------------------------------
## # Statistics:
## #
## # Upper bound:                   0.143
## # Precision:                     0.133
## # Mode:                          0.01
## # Mean:                          0.053
## # Median:                        0.04
## # ------------------------------------------------------------

You can visually inspect the prior distribution using the plot() function.

plot(prior2)

### Bayesian Risk Assessment Model (method = 'bram')

You can incorporate information about the expected errors (mode) and the upper confidence bound of the prior distribution according to the Bayesian Risk Assessment Model (BRAM) using method = 'bram'. As an example, the code below incorporates the information that the mode of the prior distribution is 1% and the upper bound is 60%.

prior3 <- auditPrior(method = 'bram', likelihood = likelihood,
expectedError = expectedError, confidence = confidence,
materiality = materiality, ub = 0.6)
summary(prior3)
## # ------------------------------------------------------------
## #         jfa Prior Distribution Summary (Bayesian)
## # ------------------------------------------------------------
## # Input:
## #
## # Confidence:                    95%
## # Expected sample errors:        1%
## # Likelihood:                    binomial
## # Specifics:                     Mode = 0.01; Upper bound = 0.6
## # ------------------------------------------------------------
## # Output:
## #
## # Prior distribution:            beta(a = 1.023, ß = 3.317)
## # Implicit sample size:          2.34
## # Implicit errors:               0.023
## # ------------------------------------------------------------
## # Statistics:
## #
## # Upper bound:                   0.599
## # Precision:                     0.589
## # Mode:                          0.01
## # Mean:                          0.236
## # Median:                        0.194
## # ------------------------------------------------------------

You can visually inspect the prior distribution using the plot() function.

plot(prior3)

### Equal prior probabilities (method = 'median')

You can incorporate the assumption that tolerable misstatement is equally likely as intolerable misstatement using method = 'median'. As an example, the code below incorporates this assumption into a prior distribution.

Note: This method requires that you specify a value for the materiality.

prior4 <- auditPrior(method = 'median', likelihood = likelihood,
expectedError = expectedError, confidence = confidence,
materiality = materiality)
summary(prior4)
## # ------------------------------------------------------------
## #         jfa Prior Distribution Summary (Bayesian)
## # ------------------------------------------------------------
## # Input:
## #
## # Confidence:                    95%
## # Expected sample errors:        1%
## # Likelihood:                    binomial
## # Specifics:                     p(T < 0.05) = p(T > 0.05) = 0.5
## # ------------------------------------------------------------
## # Output:
## #
## # Prior distribution:            beta(a = 1.155, ß = 16.385)
## # Implicit sample size:          15.54
## # Implicit errors:               0.155
## # ------------------------------------------------------------
## # Statistics:
## #
## # Upper bound:                   0.181
## # Precision:                     0.171
## # Mode:                          0.01
## # Mean:                          0.066
## # Median:                        0.05
## # ------------------------------------------------------------

You can visually inspect the prior distribution using the plot() function.

plot(prior4)

### Custom prior probabilities (method = 'hypotheses')

You can assign custom probabilities to the hypothesis of tolerable misstatement (using pHmin) and/or the hypotheses of intolerable misstatement (using pHplus) in combination with method = 'hypotheses'. As an example, the code below incorporates the information that the hypothesis of tolerable misstatement has a probability of 60% into a prior distribution.

Note: This method requires that you specify a value for the materiality.

prior5 <- auditPrior(method = 'hypotheses', likelihood = likelihood,
expectedError = expectedError, confidence = confidence,
materiality = materiality, pHmin = 0.6)
summary(prior5)
## # ------------------------------------------------------------
## #         jfa Prior Distribution Summary (Bayesian)
## # ------------------------------------------------------------
## # Input:
## #
## # Confidence:                    95%
## # Expected sample errors:        1%
## # Likelihood:                    binomial
## # Specifics:                     p(T < 0.05) = 0.6; p(T > 0.05) = 0.4
## # ------------------------------------------------------------
## # Output:
## #
## # Prior distribution:            beta(a = 1.217, ß = 22.493)
## # Implicit sample size:          21.71
## # Implicit errors:               0.217
## # ------------------------------------------------------------
## # Statistics:
## #
## # Upper bound:                   0.14
## # Precision:                     0.13
## # Mode:                          0.01
## # Mean:                          0.051
## # Median:                        0.039
## # ------------------------------------------------------------

You can visually inspect the prior distribution using the plot() function.

plot(prior5)

### Earlier sample (method = 'sample')

You can incorporate information from an earlier sample into the prior distribution using method = 'sample' in combination with sampleN and sampleK. As an example, the code below incorporates the information from an earlier sample of 30 items in which 0 misstatements were found into a prior distribution.

prior6 <- auditPrior(method = 'sample', likelihood = likelihood,
expectedError = expectedError, confidence = confidence,
materiality = materiality, sampleN = 30, sampleK = 0)
summary(prior6)
## # ------------------------------------------------------------
## #         jfa Prior Distribution Summary (Bayesian)
## # ------------------------------------------------------------
## # Input:
## #
## # Confidence:                    95%
## # Expected sample errors:        1%
## # Likelihood:                    binomial
## # Specifics:                     Earlier sample of 30 items with 0 errors
## # ------------------------------------------------------------
## # Output:
## #
## # Prior distribution:            beta(a = 1, ß = 31)
## # Implicit sample size:          30
## # Implicit errors:               0
## # ------------------------------------------------------------
## # Statistics:
## #
## # Upper bound:                   0.092
## # Precision:                     0.092
## # Mode:                          0
## # Mean:                          0.031
## # Median:                        0.022
## # ------------------------------------------------------------

You can visually inspect the prior distribution using the plot() function.

plot(prior6)

### Weighted earlier sample (method = 'factor')

You can incorporate information from last years results, weighted by a factor, into the prior distribution using method = 'factor' in combination with sampleN and sampleK. As an example, the code below incorporates the information from a last years results (a sample of 58 items in which 0 misstatements were found), weighted by a factor 0.7, into a prior distribution.

prior7 <- auditPrior(method = 'factor', likelihood = likelihood,
expectedError = expectedError, confidence = confidence,
materiality = materiality, sampleN = 58, sampleK = 0, factor = 0.7)
summary(prior7)
## # ------------------------------------------------------------
## #         jfa Prior Distribution Summary (Bayesian)
## # ------------------------------------------------------------
## # Input:
## #
## # Confidence:                    95%
## # Expected sample errors:        1%
## # Likelihood:                    binomial
## # Specifics:                     Earlier sample of 58 items with 0 errors weighted by 0.7
## # ------------------------------------------------------------
## # Output:
## #
## # Prior distribution:            beta(a = 1, ß = 41.6)
## # Implicit sample size:          40.6
## # Implicit errors:               0
## # ------------------------------------------------------------
## # Statistics:
## #
## # Upper bound:                   0.069
## # Precision:                     0.069
## # Mode:                          0
## # Mean:                          0.023
## # Median:                        0.017
## # ------------------------------------------------------------

You can visually inspect the prior distribution using the plot() function.

plot(prior7)

## Using a prior distribution

Bayesian statistics allows the auditor to build on their existing information. Therefore, the objects returned by the auditPrior() function can be used as input for the prior argument in the planning() and evaluation() functions.

### Combining auditPrior() with planning()

The prior distribution can be used the planning stage to calculate a minimum sample size by providing the objected returned by the auditPrior() function to the planning() function. For example, the code below calculates the minimum sample size to test the misstatement in the population against a performance materiality of 5%, while incorporating the information in prior7.

jfa::planning(materiality = materiality, expectedError = expectedError,
confidence = confidence, prior = prior7)
## Minimum sample size: 27
## Sample size obtained in 29 iteration(s) via method 'binomial'.

### Combining auditPrior() with evaluation()

The prior distribution can be used the evaluation stage by providing the objected returned by the auditPrior() function to the evaluation() function. For example, the code below evaluates the misstatement in the population with respect to the performance materiality of 5% after seeing a sample of 60 items with 1 misstatement, while incorporating the information in prior7.

jfa::evaluation(materiality = materiality, confidence = confidence,
nSumstats = 60, kSumstats = 1, prior = prior7)
## Most likely error: 0.994% | 95% Upper bound: 4.584% | Precision: 3.59% | BF-+: 3.745
## Estimates obtained via method 'binomial'.