This function takes a data frame (using `data`

, `values`

, and `values.audit`

) or summary statistics (using `x`

and `n`

) and performs inference on the misstatement in the sample. The function returns an object of class `jfaEvaluation`

which can be used with associated `summary()`

and `plot()`

methods.

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

```
evaluation(materiality = NULL, min.precision = NULL, method = 'poisson',
alternative = c('less', 'two.sided', 'greater'), conf.level = 0.95,
data = NULL, values = NULL, values.audit = NULL, times = NULL,
x = NULL, n = NULL, N.units = NULL, N.items = NULL,
r.delta = 2.7, m.type = 'accounts', cs.a = 1, cs.b = 3, cs.mu = 0.5,
prior = FALSE)
```

- materiality
a numeric value between 0 and 1 specifying the performance materiality (maximum tolerable error) as a fraction of the total size of the population. If specified, the function also returns the conclusion of the analysis with respect to the performance materiality. The value is discarded when

`direct`

,`difference`

,`quotient`

, or`regression`

method is chosen.- min.precision
a numeric value between 0 and 1 specifying the required minimum precision (upper bound minus most likely error) as a fraction of the total size of the population. If specified, the function also returns the conclusion of the analysis with respect to the required minimum precision.

- method
a character specifying the method to be used in the evaluation. Possible options are

`poisson`

,`binomial`

(default),`hypergeometric`

,`mpu`

,`stringer`

,`stringer.meikle`

,`stringer.lta`

,`stringer.pvz`

,`rohrbach`

,`moment`

,`direct`

,`difference`

,`quotient`

, or`regression`

. See the details section for more information.- alternative
a character indicating the alternative hypothesis to be tested (and the type of interval to be produced). This must be one of

`less`

(default),`two.sided`

, or`greater`

. You can specify just the initial letter.- conf.level
a numeric value between 0 and 1 specifying the confidence level used in the evaluation. Defaults to 0.95 for 95% confidence.

- data
a data frame containing the sample to be evaluated. The sample must at least contain a column of book values and a column of audit (true) values.

- values
a character specifying name of a column in

`data`

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

`data`

containing the audit (true) values of the items.- times
a character specifying name of a column in

`data`

containing the number of times each item in the`data`

should be counted in the evaluation (due to it being selected multiple times for the sample).- x
a numeric value larger than 0 specifying the sum of errors found in the sample. If specified, overrides the

`data`

,`values`

and`values.audit`

arguments and assumes that the data come from summary statistics specified by both`x`

and`n`

.- n
an integer larger than 0 specifying the number of items in the sample. If specified, overrides the

`data`

,`values`

and`values.audit`

arguments and assumes that the data come from summary statistics specified by both`x`

and`n`

.- N.units
an integer larger than 0 specifying the total number of sampling units in the population (i.e., the population size / value). Only required if

`method`

is one of`'hypergeometric'`

,`direct`

,`difference`

,`quotient`

, or`regression`

.- N.items
an integer larger than 0 specifying the total number of items in the population. Only required if

`method`

is one of`direct`

,`difference`

,`quotient`

, or`regression`

.- r.delta
if

`method = 'rohrbach'`

, a numeric value specifying \(\Delta\) in Rohrbach's augmented variance bound (Rohrbach, 1993).- m.type
if

`method = 'moment'`

, a character specifying the type of population (Dworin and Grimlund, 1984). Possible options are`accounts`

and`inventory`

. This argument affects the calculation of the central moments in the bound.- cs.a
if

`method = "coxsnell"`

, a numeric value specifying the \(\alpha\) parameter of the prior distribution on the mean taint. Defaults to 1 as recommended by Cox and Snell (1979).- cs.b
if

`method = "coxsnell"`

, a numeric value specifying the \(\beta\) parameter of the prior distribution on the mean taint. Defaults to 3 as recommended by Cox and Snell (1979).- cs.mu
if

`method = "coxsnell"`

, a numeric value between 0 and 1 specifying the mean of the prior distribution on the mean taint. Defaults to 0.5 as recommended by Cox and Snell (1979).- prior
a logical specifying if a prior distribution must be used, or an object of class

`jfaPrior`

or`jfaPosterior`

containing the prior distribution. Defaults to`FALSE`

for frequentist planning. If`TRUE`

, a minimal information prior is chosen by default. Chooses a conjugate gamma distribution for the Poisson likelihood, a conjugate beta distribution for the binomial likelihood, and a conjugate beta-binomial distribution for the hypergeometric likelihood.

An object of class `jfaEvaluation`

containing:

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

- mle
a numeric value between 0 and 1 indicating the most likely error in the population as a fraction of its total size.

- ub
a numeric value indicating the upper bound on the (probability of) misstatement.

- lb
a numeric value indicating the lower bound of the interval around the (probability of) misstatement.

- precision
a numeric value between 0 and 1 indicating the difference between the most likely error and the upper bound in the population as a fraction of the total population size.

- p.value
a numeric value indicating the one-sided p-value.

- x
an integer larger than, or equal to, 0 indicating the number of items in the sample that contained an error.

- t
a value larger than, or equal to, 0, indicating the sum of observed taints.

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

- materiality
if

`materiality`

is specified, a numeric value between 0 and 1 indicating the performance materiality as a fraction of the total population size.- min.precision
if

`min.precision`

is specified, a numeric value between 0 and 1 indicating the minimum required precision as a fraction of the total population size.- alternative
a character indicating the alternative hypothesis.

- method
a character indicating the evaluation method.

- N.units
if

`N.units`

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

`N.items`

is specified, in integer larger than 0 indicating the total 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`

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

This section lists the available options for the `methods`

argument.

`poisson`

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

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

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

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

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

, performs Bayesian evaluation using a*beta-binomial*prior and posterior.`mpu`

: Evaluates the sample with the mean-per-unit estimator.`stringer`

: Evaluates the sample with the Stringer bound (Stringer, 1963).`stringer.meikle`

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

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

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

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

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

: Evaluates the sample with the Cox and Snell bound (Cox and Snell, 1979).`direct`

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

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

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

: Evaluates the sample with 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.

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.

Dworin, L. D. and Grimlund, R. A. (1984). Dollar-unit sampling for accounts receivable and inventory. *The Accounting Review*, 59(2), 218–241

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

Meikle, G. R. (1972). *Statistical Sampling in an Audit Context: An Audit Technique*. 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.

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.

```
data("BuildIt")
# Draw a sample of 100 monetary units from the population using
# fixed interval monetary unit sampling
sample <- selection(
data = BuildIt, size = 100, units = "values",
method = "interval", values = "bookValue"
)$sample
# Classical evaluation using the Stringer bound
evaluation(
materiality = 0.05, method = "stringer", conf.level = 0.95,
data = sample, values = "bookValue", values.audit = "auditValue"
)
#>
#> Classical Audit Sample Evaluation
#>
#> data: sample
#> number of errors = 4, number of samples = 100, taint = 2.4
#> 95 percent confidence interval:
#> 0.00000000 0.06532286
#> estimate:
#> 0.0239999
#> estimates obtained via method 'stringer'
# Classical evaluation using the Poisson likelihood
evaluation(
materiality = 0.05, method = "poisson", conf.level = 0.95,
data = sample, values = "bookValue", values.audit = "auditValue"
)
#>
#> Classical Audit Sample Evaluation
#>
#> data: sample
#> number of errors = 4, number of samples = 100, taint = 2.4, p-value =
#> 0.1747
#> alternative hypothesis: true misstatement rate is less than 0.05
#> 95 percent confidence interval:
#> 0.00000000 0.06887548
#> estimate:
#> 0.0239999
#> estimates obtained via method 'poisson'
# Bayesian evaluation using a noninformative gamma prior distribution
evaluation(
materiality = 0.05, method = "poisson", conf.level = 0.95,
data = sample, values = "bookValue", values.audit = "auditValue",
prior = TRUE
)
#>
#> Bayesian Audit Sample Evaluation
#>
#> data: sample
#> number of errors = 4, number of samples = 100, taint = 2.4, BF₁₀ =
#> 95.641
#> alternative hypothesis: true misstatement rate is less than 0.05
#> 95 percent credible interval:
#> 0.00000000 0.06819355
#> estimate:
#> 0.02376227
#> estimates obtained via method 'poisson' + 'prior'
# Bayesian evaluation using an informed prior distribution
evaluation(
materiality = 0.05, method = "poisson", conf.level = 0.95,
data = sample, values = "bookValue", values.audit = "auditValue",
prior = auditPrior(method = "param", alpha = 1, beta = 10)
)
#>
#> Bayesian Audit Sample Evaluation
#>
#> data: sample
#> number of errors = 4, number of samples = 100, taint = 2.4, BF₁₀ =
#> 10.548
#> alternative hypothesis: true misstatement rate is less than 0.05
#> 95 percent credible interval:
#> 0.00000000 0.06261408
#> estimate:
#> 0.02181809
#> estimates obtained via method 'poisson' + 'prior'
```