-
Notifications
You must be signed in to change notification settings - Fork 0
/
introduction.qmd
99 lines (59 loc) · 9.13 KB
/
introduction.qmd
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
```{r echo = FALSE, cache = FALSE}
source("utils.R", local = TRUE)
```
# Getting Started {.unnumbered}
This book is intended for auditors that want to obtain the knowledge and skill to utilize statistical audit sampling in their practice using the R programming language. It covers an array of traditional and innovative statistical tools that are available to auditors, explaining their function, the underlying assumptions, and when they are best utilized. In addition, it offers practical guidance on integrating advanced statistical sampling methodology into audit practice and demonstrates its value through real-world case studies. It is our hope that this book will serve as a valuable resource for auditors looking to effectively and efficiently utilize statistical methods in their practice.
The aim of this book is to address the need for a clear and transparent explanation of the use of statistical sampling methodology in audit practice. Most guidance about audit sampling (e.g., @AICPA-A; @AICPA-C) lacks sufficient detail to allow for full transparency or a deep understanding. Additionally, the implementation of statistical sampling methodology in practice is often even less transparent, as theory and calculations are hidden from auditors in commercial closed-source tools or in Excel sheets from audit guides used internally by audit firms (one notable exception is @Stewart2012). Thus, while attempting to comprehend the theoretical aspects of statistical audit sampling, auditors may encounter numerous relevant questions that are left unanswered by these tools. This book aims to clarify the statistical methodology utilized in practice, thereby empowering auditors through a comprehensive explanation.
This book discusses two philosphies to statistical audit sampling: the classical (frequentist) philosophy and the Bayesian philosophy. By contrasting these two approaches, the book elucidates the statistical theory that underlies commonly used audit sampling techniques and illustrates how to utilize these techniques in accordance with international auditing standards. Additionally, the book demonstrates the use of Bayesian statistical methods in auditing practice and highlights the practical advantages that these methods can offer for auditors.
The structure of this book is as follows: Chapter 2 introduces the basics of the R programming language. Chapter 3 discusses the fundamental statistical theory relevant to classical and Bayesian audit sampling. Subsequent chapters 4, 5, 6, 7 and 8 provide a more in-depth exploration of the use of these methods for statistical planning, selection, and evaluation of audit samples. These chapters illustrate the practical differences and similarities between the classical and the Bayesian approach through code and examples, thus requiring minimal programming knowledge to follow along. Finally, Chapter 9 and 10 discuss other open-source software implementations of audit sampling using R.
In each chapter, we aim to adhere to a consistent structure: beginning with motivating examples to provide a broader context, and then delving into the specifics. Every section of the book is accompanied by exercises designed to reinforce the concepts learned. Although it may be tempting to skip the exercises, the most effective way to learn is by applying the concepts to actual problems through practice.
## Prerequisites
To run the code in this book, you will need three things: R, RStudio, and the **jfa** package.
### R
The **C**omprehensive **R** **A**rchive **N**etwork (CRAN) is a collection of mirror servers distributed globally that can be utilized to obtain both R and R packages. When seeking to download R, it is recommended to utilize the cloud mirror located at [`https://cloud.r-project.org`](https://cloud.r-project.org), as it will automatically determine the most suitable mirror for your location. Please ensure that you have at least R `3.5.0` installed for the purposes of this book.
It is advisable to regularly update R, as new major versions are released annually and minor releases occur two to three times per year. While upgrading can be inconvenient, particularly for major versions which require the reinstallation of all packages, failing to do so will only exacerbate the issue.
### RStudio
RStudio is an Integrated Development Environment (IDE) specifically designed for the R programming language. It can be downloaded and installed from the official website ([`https://posit.co/downloads/`](https://posit.co/downloads/)). RStudio undergoes updates several times a year, and users will be notified when a new version becomes available. It is recommended to regularly upgrade RStudio to access the latest features. Please ensure that you have at least RStudio `1.0.0` installed for the purposes of this book.
When you start RStudio, you’ll see three important regions in the interface: the console, the environment and the output panel.
![The RStudio IDE with the three important regions: the console, the environment, and the output panel. The console, located in the left panel, allows users to execute R code. The environment, displayed in the top right panel, keeps track of the variables and objects created in the session. The output panel, located in the bottom right, shows the generated plots.](img/rstudio.png){#fig-rstudio fig-align="center" width=100%}
The console in the left panel allows you to run R code. To execute some R code, type the code in the console (e.g., `1 + 1`) and press Enter. When you stored the results of a computation in a new variable (e.g., `x <- 1 + 1`), the variable is displayed in the environment in the top right panel. The environment allows you to keep track of the objects you have created during your R session. Finally, any plots that you request are displayed in the output panel in the bottom right.
### jfa
R has many packages and libraries that extend its capabilities and provide additional functions and tools for data analysis and visualization. R packages are the core building blocks of reproducible R code. They consist of reusable functions, the documentation describing how to utilize them, and sample data. Some popular packages include `dplyr` for data manipulation, `ggplot2` for data visualization, and `caret` for machine learning. If you want to learn more about creating your own R package, @Wickam2022 provide an excellent first-hand description of the principles and practices of creating R packages.
::: {#fig-packages layout="[[-2.5,30,-2.5,30,-2.5,30,-2.5]]"}
![`dplyr`](img/logo_dplyr.png){#fig-dplyr-logo}
![`ggplot2`](img/logo_ggplot2.png){#fig-ggplot2-logo}
![`jfa`](img/logo_jfa.png){#fig-jfa-logo}
R boasts an impressive amount of packages and libraries that enhance its capabilities by providing additional features. For example, the (a) `dplyr` package assists with data manipulation, the (b) `ggplot2` package supports data visualization, and the (c) `jfa` package facilitates statistical auditing.
:::
To illustrate its concepts and ideas, this book uses the **jfa** package, an R package for statistical auditing, which can also be downloaded from CRAN. This can be done via the `install.packages()` function by providing the package name in quotes. Thus, before running the examples in this book, you should install the **jfa** package by running the following command in R:
```{r, eval=FALSE}
install.packages("jfa")
```
Once you have installed a package, you must load it into every R session. To load a package into your R session, call `library()` and provide the name of the package (without quotes) that you want to load. For example, before running the examples in this book, you should load the **jfa** package with:
```{r, eval=FALSE}
library(jfa)
```
R packages are updated regularly. To update a package in your R library you should call `update.packages()` and provide the name of the package that you want to update in quotes. For example, each time there is a new release of the **jfa** package, you can update it by running:
```{r, eval=FALSE}
update.packages("jfa")
```
If you want to look at the source code of the **jfa** package, see the package website at [`https://koenderks.github.io/jfa`](https://koenderks.github.io/jfa/).
## Running R Code
The code in this book appears as follows:
```{r}
1 + 1
```
When executing the same code within your local console, the resulting output will appear as follows:
```{r eval = FALSE}
> 1 + 1
[1] 2
```
There are two primary distinctions between the use of a console and the presentation of code in the book. Firstly, in a console, the user inputs their code after the prompt symbol (`>`) while the book does not display this symbol. Secondly, the output in the book is commented out with `#>`, while in a console it is displayed directly after the inputted code. Hence, those working with an electronic version of the book can directly copy code from the book to the console.
## Colophon
An online version of this book is available at [`https://koenderks.github.io/sasr/`](https://koenderks.github.io/sasr/). The source code of the book is available at [`https://github.com/koenderks/sasr`](https://github.com/koenderks/sasr).
::: {.content-visible when-format="html"}
This book was built using the following R packages:
```{r}
sessioninfo::session_info()
```
:::