`evaluation()`

is used to perform statistical inference
about the misstatement in a population after auditing a statistical sample.
It allows specification of statistical requirements for the sample with
respect to the performance materiality or the precision. The function returns
an object of class `jfaEvaluation`

that can be used with associated
`summary()`

and `plot()`

methods.

```
evaluation(
materiality = NULL,
method = c(
"poisson", "binomial", "hypergeometric",
"inflated.poisson", "hurdle.beta",
"stringer.poisson", "stringer.binomial", "stringer.hypergeometric",
"stringer.meikle", "stringer.lta", "stringer.pvz", "stringer",
"rohrbach", "moment", "coxsnell", "mpu", "pps",
"direct", "difference", "quotient", "regression"
),
alternative = c("less", "two.sided", "greater"),
conf.level = 0.95,
data = NULL,
values = NULL,
values.audit = NULL,
strata = NULL,
times = NULL,
x = NULL,
n = NULL,
N.units = NULL,
N.items = NULL,
pooling = c("none", "complete", "partial"),
prior = FALSE
)
```

- materiality
a numeric value between 0 and 1 specifying the performance materiality (i.e., the maximum tolerable misstatement in the population) as a fraction of the total number of units in the population. Can be

`NULL`

. Not used for methods`direct`

,`difference`

,`quotient`

, and`regression`

.- method
a character specifying the statistical method. Possible options are

`poisson`

(default),`binomial`

,`hypergeometric`

,`stringer.poisson`

,`stringer.binomial`

,`stringer.hypergeometric`

,`stringer.meikle`

,`stringer.lta`

,`stringer.pvz`

,`rohrbach`

,`moment`

,`mpu`

,`pps`

,`direct`

,`difference`

,`quotient`

, or`regression`

. See the details section for more information.- alternative
a character indicating the alternative hypothesis and the type of confidence / credible interval returned by the function. Possible options are

`less`

(default),`two.sided`

, or`greater`

.- conf.level
a numeric value between 0 and 1 specifying the confidence level (i.e., 1 - audit risk / detection risk).

- data
a data frame containing a data sample.

- values
a character specifying name of a numeric column in

`data`

containing the book values of the items.- values.audit
a character specifying name of a numeric column in

`data`

containing the audit (i.e., true) values of the items.- strata
a character specifying name of a factor column in

`data`

indicating to which stratum the item belongs.- times
a character specifying name of an integer column in

`data`

containing the number of times an item should be counted due to (not) being selected (multiple times) for the sample. Items for which this value is 0 will not be included in the evaluation.- x
a numeric value or vector of values equal to or larger than 0 specifying the sum of (proportional) misstatements in the sample or, if this is a vector, the sum of taints in each stratum. If this argument is specified, the input for the

`data`

,`values`

and`values.audit`

arguments is discarded and it is assumed that the data come from summary statistics specified by`x`

and`n`

.- n
an integer or vector of integers larger than 0 specifying the sum of (proportional) misstatements in the sample or, if this is a vector, the sum of taints in each stratum. If this argument is specified, the input for the

`data`

,`values`

and`values.audit`

arguments is discarded and it is assumed that the data come from summary statistics specified by`x`

and`n`

.- N.units
a numeric value or vector of values than 0 specifying the total number of units in the population or, if this is a vector, the total number of units in each stratum of the population. This argument is strictly required for the

`hypergeometric`

,`direct`

,`difference`

,`quotient`

, and`regression`

methods, but is also used in stratification to weigh the estimates of each individual stratum to arrive at the population estimate. If`NULL`

, each stratum is assumed to be equally represented in the population.- N.items
an integer larger than 0 specifying the number of items in the population. Only used for methods

`direct`

,`difference`

,`quotient`

, and`regression`

.- pooling
a character specifying the type of model to use when analyzing stratified samples. Possible options are

`none`

(default) for no pooling (i.e., no information is shared between strata),`complete`

for complete pooling (i.e., all information is shared between strata) or`partial`

for partial pooling (i.e., some information is shared between strata). The latter two options fit a Bayesian model to the data using a MCMC sampling procedure whose options can be set globally using`options("mc.iterations")`

(otherwise: 2000),`options("mc.warmup")`

(otherwise: 1000),`options("mc.chains")`

(otherwise: 4) and`options("mc.cores")`

(otherwise: 1).- prior
a logical specifying whether to use a prior distribution, or an object of class

`jfaPrior`

or`jfaPosterior`

. If this argument is specified as`FALSE`

(default), the function performs classical evaluation. If this argument is specified as`TRUE`

or as a prior from`auditPrior`

, this function performs Bayesian evaluation using the specified prior.

An object of class `jfaEvaluation`

containing:

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

- mle
a numeric value between 0 and 1 giving the most likely misstatement in the population as a fraction.

- ub
a numeric value between 0 and 1 giving the upper bound for the misstatement in the population.

- lb
a numeric value between 0 and 1 giving the lower bound for the misstatement in the population.

- precision
a numeric value between 0 and 1 giving the difference between the most likely misstatement and the bound relative to

`alternative`

.- p.value
for classical tests, a numeric value giving the p-value.

- x
an integer larger than, or equal to, 0 giving the number of misstatements in the sample.

- t
a value larger than, or equal to, 0, giving the sum of proportional misstatements in the sample.

- n
an integer larger than 0 giving the sample size.

- materiality
if

`materiality`

is specified, a numeric value between 0 and 1 giving the performance materiality as a fraction.- alternative
a character indicating the alternative hypothesis.

- method
a character the method used.

- N.units
if

`N.units`

is specified, in integer larger than 0 indicating the number of units in the population- N.items
if

`N.items`

is specified, in integer larger than 0 indicating the number of items in the population.- K
if

`method = 'hypergeometric'`

, an integer indicating the assumed total errors in the population.- prior
an object of class

`jfaPrior`

that contains the prior distribution.- posterior
an object of class

`jfaPosterior`

that contains the posterior distribution.- data
a data frame containing the relevant columns from the

`data`

.- strata
a data frame containing the relevant statistical results for the strata.

- data.name
a character giving the name of the data.

This section lists the available options for the `method`

argument.

`poisson`

: Evaluates the sample with the Poisson distribution. If combined with`prior = TRUE`

, performs Bayesian evaluation using a*gamma*prior.`binomial`

: Evaluates the sample with the binomial distribution. If combined with`prior = TRUE`

, performs Bayesian evaluation using a*beta*prior.`hypergeometric`

: Evaluates the sample with the hypergeometric distribution. If combined with`prior = TRUE`

, performs Bayesian evaluation using a*beta-binomial*prior.`inflated.poisson`

: Inflated Poisson model incorporating the explicit probability of misstatement being zero. If`prior = TRUE`

, performs Bayesian evaluation using a*beta*prior.`hurdle.beta`

: Hurdle beta model incorporating the explicit probability of a taint being zero, one, or in between. If`prior = TRUE`

, this setup performs Bayesian evaluation using a*beta*prior.`stringer.poisson`

: Evaluates the sample with the Stringer bound using the Poisson distribution.`stringer.binomial`

: Evaluates the sample with the Stringer bound using the binomial distribution (Stringer, 1963).`stringer.hypergeometric`

: Evaluates the sample with the Stringer bound using the hypergeometric distribution.`stringer.meikle`

: Evaluates the sample using the Stringer bound with Meikle's correction for understatements (Meikle, 1972).`stringer.lta`

: Evaluates the sample using the Stringer bound with LTA correction for understatements (Leslie, Teitlebaum, and Anderson, 1979).`stringer.pvz`

: Evaluates the sample using the Stringer bound with Pap and van Zuijlen's correction for understatements (Pap and van Zuijlen, 1996).`rohrbach`

: Evaluates the sample using Rohrbach's augmented variance bound (Rohrbach, 1993).`moment`

: Evaluates the sample using the modified moment bound (Dworin and Grimlund, 1984).`coxsnell`

: Evaluates the sample using the Cox and Snell bound (Cox and Snell, 1979).`mpu`

: Evaluates the sample with the mean-per-unit estimator using the Normal distribution.`pps`

: Evaluates the sample with the proportional-to-size estimator using the Student-t distribution.`direct`

: Evaluates the sample using the direct estimator (Touw and Hoogduin, 2011).`difference`

: Evaluates the sample using the difference estimator (Touw and Hoogduin, 2011).`quotient`

: Evaluates the sample using the quotient estimator (Touw and Hoogduin, 2011).`regression`

: Evaluates the sample using the regression estimator (Touw and Hoogduin, 2011).

Cox, D. and Snell, E. (1979). On sampling and the estimation of
rare errors. *Biometrika*, 66(1), 125-132.
doi:10.1093/biomet/66.1.125
.

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.
(2024). The Bayesian approach to audit evidence: Quantifying statistical
evidence using the Bayes factor. *Auditing: A Journal of Practice &
Theory*. doi:10.2308/AJPT-2021-086

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

Derks, K., de Swart, J., Wagenmakers, E.-J., & Wetzels, R.
(2022). Bayesian generalized linear modeling for audit sampling: How to
incorporate audit information into the statistical model. *PsyArXiv*.
doi:10.31234/osf.io/byj2a

Dworin, L. D. and Grimlund, R. A. (1984). Dollar-unit sampling
for accounts receivable and inventory. *The Accounting Review*, 59(2),
218-241. https://www.jstor.org/stable/247296

Leslie, D. A., Teitlebaum, A. D., & Anderson, R. J. (1979).
*Dollar-unit Sampling: A Practical Guide for Auditors*. Copp Clark
Pitman; Belmont, CA. ISBN: 9780773042780.

Meikle, G. R. (1972). *Statistical Sampling in an Audit
Context*. Canadian Institute of Chartered Accountants.

Pap, G., and van Zuijlen, M. C. (1996). On the asymptotic
behavior of the Stringer bound. *Statistica Neerlandica*, 50(3),
367-389. doi:10.1111/j.1467-9574.1996.tb01503.x
.

Rohrbach, K. J. (1993). Variance augmentation to achieve nominal
coverage probability in sampling from audit populations. *Auditing*,
12(2), 79.

Stringer, K. W. (1963). Practical aspects of statistical sampling
in auditing. *In Proceedings of the Business and Economic Statistics
Section* (pp. 405-411). American Statistical Association.

Touw, P., and Hoogduin, L. (2011). *Statistiek voor Audit en
Controlling*. Boom uitgevers Amsterdam.

```
# Using summary statistics
evaluation(materiality = 0.05, x = 0, n = 100) # Non-stratified
#>
#> Classical Audit Sample Evaluation
#>
#> data: 0 and 100
#> number of errors = 0, number of samples = 100, taint = 0, p-value =
#> 0.0067379
#> alternative hypothesis: true misstatement rate is less than 0.05
#> 95 percent confidence interval:
#> 0.00000000 0.02995732
#> most likely estimate:
#> 0
#> results obtained via method 'poisson'
evaluation(materiality = 0.05, x = c(2, 1, 0), n = c(50, 70, 40)) # Stratified
#>
#> Classical Audit Sample Evaluation
#>
#> data: 3 and 160
#> number of errors = 3, number of samples = 160, taint = 3, p-value = NA
#> alternative hypothesis: true misstatement rate is less than 0.05
#> 95 percent confidence interval:
#> 0.00000000 0.06702395
#> most likely estimate:
#> 0.018095
#> results obtained via method 'poisson' + 'no-pooling'
# Using data
data("BuildIt")
BuildIt$inSample <- c(rep(1, 100), rep(0, 3400))
levs <- c("low", "medium", "high")
BuildIt$stratum <- factor(c(levs[3], levs[2], rep(levs, times = 1166)))
sample <- subset(BuildIt, BuildIt$inSample == 1)
# Non-stratified evaluation
evaluation(
materiality = 0.05, data = sample,
values = "bookValue", values.audit = "auditValue"
)
#>
#> Classical Audit Sample Evaluation
#>
#> data: sample
#> number of errors = 5, number of samples = 100, taint = 3, p-value =
#> 0.26502
#> alternative hypothesis: true misstatement rate is less than 0.05
#> 95 percent confidence interval:
#> 0.00000000 0.07753631
#> most likely estimate:
#> 0.03
#> results obtained via method 'poisson'
# Stratified evaluation
evaluation(
materiality = 0.05, data = sample, values = "bookValue",
values.audit = "auditValue", strata = "stratum"
)
#>
#> Classical Audit Sample Evaluation
#>
#> data: sample
#> number of errors = 5, number of samples = 100, taint = 3, p-value = NA
#> alternative hypothesis: true misstatement rate is less than 0.05
#> 95 percent confidence interval:
#> 0.0000000 0.1049822
#> most likely estimate:
#> 0.029946
#> results obtained via method 'poisson' + 'no-pooling'
```