/
audit-sampling.Rmd
167 lines (134 loc) · 6.42 KB
/
audit-sampling.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
---
title: "Audit sampling: Get started"
author: Koen Derks
output:
html_document:
toc: true
toc_depth: 3
bibliography: references.bib
csl: apa.csl
vignette: >
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
nocite: |
@iaasb_2018, @prompers_2019, @manitz_2021
---
```{r, include = FALSE}
library(jfa)
```
## Introduction
Welcome to the 'Audit sampling' vignette of the **jfa** package. This page
provides a straightforward guide to the functions in the package that are
designed to facilitate statistical audit sampling. Specifically, these functions
implement standard audit sampling techniques to calculate sample sizes, select
items from a population, and evaluate the misstatement in a data sample
compliant with international standards on auditing [@iaasb_2018; @aicpa_2021;
@pcaob_2020]. The package allows enables to specify a prior probability
distribution to conduct Bayesian audit sampling using these functions.
## Functions and intended usage
Below you can find an explanation of the available functions in **jfa**, sorted
by their occurrence in the standard audit sampling workflow.
- [`auditPrior()`](#creating-a-prior-distribution)
- [`planning()`](#planning-a-sample)
- [`selection()`](#selecting-a-sample)
- [`evaluation()`](#evaluating-a-sample)
### Creating a prior distribution
The `auditPrior()` function is used to specify a prior distribution for Bayesian
audit sampling. It enables formal translation of pre-existing audit information
into a prior distribution or complete customization of the prior distribution.
The function returns an object which can be used with associated `summary()` and
`plot()` methods. Objects returned by this function can also be used as input
for the `prior` argument in other functions. Additionally, these objects have a
corresponding `predict()` method to generate the predictions of the prior
distribution on the data level.
For additional details about this function, please refer to the
[function documentation](https://koenderks.github.io/jfa/reference/auditPrior.html)
on the package website.
*Example usage:*
```{r}
# Beta prior based on inherent risk (70%) and control risk (50%)
prior <- auditPrior(
method = "arm", likelihood = "binomial",
materiality = 0.05, ir = 0.7, cr = 0.5
)
summary(prior)
```
### Planning a sample
The `planning()` function is used to calculate a minimum sample size for audit
samples. It allows the specification of approval conditions for the sample with
respect to performance materiality or precision. The function returns an object
which can be used with associated `summary()` and `plot()` methods. To perform
Bayesian planning, the input for the `prior` argument can be an object returned
by the `auditPrior()` function, or an object returned by
`evaluation()$posterior`.
For additional details about this function, please refer to the
[function documentation](https://koenderks.github.io/jfa/reference/planning.html)
on the package website.
*Example usage:*
```{r}
# Poisson likelihood
x <- planning(materiality = 0.03, likelihood = "poisson")
# Default beta prior and binomial likelihood
x <- planning(materiality = 0.03, likelihood = "binomial", prior = TRUE)
# Custom beta prior and binomial likelihood
x <- planning(materiality = 0.03, likelihood = "binomial", prior = prior)
summary(x)
```
### Selecting a sample
The `selection()` function is used to perform statistical selection of audit
samples. It offers flexible implementations of the most common audit sampling
algorithms for attributes sampling and monetary unit sampling. The function
returns an object which can be used with associated `summary()` and `plot()`
methods. For convenience, the input for the `size` argument can be an returned
by the `planning()` function.
For additional details about this function, please refer to the
[function documentation](https://koenderks.github.io/jfa/reference/selection.html)
on the package website.
*Example usage:*
```{r}
# Fixed interval monetary unit sampling
x <- selection(
data = BuildIt, size = 100, units = "values",
method = "interval", values = "bookValue"
)
summary(x)
```
### Evaluating a sample
The `evaluation()` function accepts a sample or summary statistics of the sample
and performs evaluation according to the specified `method`. The function
returns an object which can be used with associated `summary()` and `plot()`
methods. To perform Bayesian evaluation, the input for the `prior` argument can
be an object returned by the `auditPrior()` function, or an object returned by
`evaluation()$posterior`.
For additional details about this function, please refer to the
[function documentation](https://koenderks.github.io/jfa/reference/evaluation.html)
on the package website.
*Example usage:*
```{r}
# Poisson likelihood
x <- evaluation(x = 1, n = 100, method = "poisson")
# Default beta prior and binomial likelihood
x <- evaluation(x = 1, n = 100, method = "binomial", prior = TRUE)
# Custom beta prior and binomial likelihood
x <- evaluation(x = 1, n = 100, method = "binomial", prior = prior)
summary(x)
```
## Benchmarks
To ensure the accuracy of statistical results, **jfa** employs automated
[unit tests](https://github.com/koenderks/jfa/tree/development/tests/testthat)
that regularly validate the output from the package against the following
established benchmarks in the area of audit sampling:
- [Audit Sampling: Audit Guide](https://www.aicpa-cima.com/cpe-learning/publication/audit-sampling-audit-guide-OPL) (Appendix A and Appendix C)
- [AuditSampler](https://cplusglobal.wordpress.com/solutions/auditsampler-statistical-sampling-software/)
- [EZ-quant](https://www.dcaa.mil/Checklists-Tools/EZ-Quant-Applications/)
- [MUS](https://cran.r-project.org/package=MUS) (R package version 0.1.6)
- [samplingbook](https://cran.r-project.org/package=samplingbook) (R package version 1.2.4)
- [SMASH21 + SMASH21-Bayes](https://steekproeven.eu/)
- [SRA](https://www.sra.nl/vaktechniek/accountancy/controle/praktijkhandreikingen/praktijkhandreiking-steekproeven-sra-steekproefmodel)
- Touw, P., and Hoogduin, L. (2011). *Statistiek voor audit en controlling*. Boom uitgevers, Amsterdam.
## Cheat sheet
The cheat sheet below will help you get started with **jfa**'s intended audit
sampling workflow. A pdf version can be downloaded [here](https://github.com/koenderks/jfa/raw/development/man/figures/cheatsheet/cheatsheet-sampling.pdf).
<p align='center'><img src='cheatsheet-sampling.png' alt='cheatsheet-sampling' width='1000'></p>
## References
<div id="refs"></div>