jfa
is an R package for statistical audit sampling. The package provides the user with five functions for planning, performing, evaluating, and reporting an audit sample. Specifically, it contains functions for calculating sample sizes, selecting the transactions according to standard audit sampling techniques, and calculating various upper limits for the misstatement from the sample or from summary statistics. The jfa
package also allows the user to create a prior probability distribution to perform Bayesian audit sampling using these functions.
For complete documentation of the package, see the package manual or visit the website.
This project is licensed under the open-source GPL-3 License.
The following instructions will get the jfa
package up and running on your local machine for use in R and RStudio.
The jfa
package is simple to download and set-up. The most recent version from CRAN (0.5.1) can be downloaded by running the following command in R or RStudio:
Alternatively, you can download the most recent (development) version from GitHub using:
The jfa
package can then be loaded in R or RStudio by typing:
To validate the output, jfa
’s results are currently being verified against the following benchmark(s):
jfa
is an open-source project that aims to be useful for the audit community. Your help in benchmarking and extending jfa
is therefore greatly appreciated. Contributing to jfa
does not have to take much time or knowledge, and there is extensive information available about it on the Wiki of this repository.
If you are willing to contribute to the improvement of the package by adding a benchmark, please check out the Wiki page on how to contribute a benchmark to jfa. If you are willing to contribute to the improvement of the package by adding a new statistical method, please check the Wiki page on how to contribute a new method to jfa.
The cheatsheet can help you get started with the jfa
package and its workflow. You can download a pdf version here.
Below you can find a list of the functions in the current version of jfa
sorted by their occurrence in the standard audit sampling workflow.
auditPrior()
function:The auditPrior()
function creates a prior distribution according to one of several methods, including the audit risk model and assessments of the inherent and control risk. The returned object is of class jfaPrior
and can be used with associated print()
and plot()
methods. jfaPrior
results can also be used as input argument for the prior
argument in other functions.
Full function with default arguments:
Supported options for the likelihood
argument:
likelihood |
Reference | Description |
---|---|---|
binomial |
Steele (1992) | Beta prior distribution (+ binomial likelihood) |
poisson |
Stewart (2013) | Gamma prior distribution (+ Poisson likelihood) |
hypergeometric |
Dyer and Pierce (1991) | Beta-binomial prior distribution (+ hypergeometric likelihood) |
Supported options for the method
argument:
method |
Reference | Description | Additional arguments |
---|---|---|---|
none |
Derks et al. (2020) | No prior information | |
arm |
Derks et al. (2020) | Inherent risk and internal control risk (ARM) |
ir and cr
|
median |
Derks et al. (2020) | Equal prior probabilities for hypotheses | |
hypotheses |
Derks et al. (2020) | Custom prior probabilities for hypotheses |
pHmin or pHplus
|
sample |
Derks et al. (2020) | Earlier sample |
sampleN and sampleK
|
factor |
Derks et al. (2020) | Weighted earlier sample |
factor , sampleN and sampleK
|
planning()
function:The planning()
function calculates the required sample size for a statistical audit sample, based on the Poisson, binomial, or hypergeometric likelihood. A prior can be specified to combine with the specified likelihood in order to perform Bayesian planning. The returned jfaPlanning
object has a print()
and a plot()
method. In the planning()
function, the prior
argument can be an object of class jfaPrior
as returned by the auditPrior()
function.
Full function with default arguments:
Supported options for the likelihood
argument:
likelihood |
Reference | Description |
---|---|---|
binomial |
Stewart (2012) | Binomial likelihood |
poisson |
Stewart (2012) | Poisson likelihood |
hypergeometric |
Stewart (2012) | Hypergeometric likelihood |
selection()
function:The selection()
function takes a data frame and performs sampling according to one of three algorithms: random sampling, cell sampling, or fixed interval sampling in combination with either record sampling or monetary unit sampling. The returned jfaSelection
object has a print()
and a plot()
method. In the selection()
function, the sampleSize
argument can be an object of class jfaPlanning
as returned by the planning()
function.
Full function with default arguments:
Supported options for the units
argument:
units |
Reference | Description | Additional arguments |
---|---|---|---|
records |
Leslie, Teitlebaum, and Anderson (1979) | Sampling units are transactions | |
mus |
Leslie, Teitlebaum, and Anderson (1979) | Sampling units are monetary units | bookValues |
Supported options for the algorithm
argument:
algorithm |
Reference | Description | Additional arguments |
---|---|---|---|
random |
Random sampling | ||
cell |
Cell sampling | ||
interval |
Systematic sampling / Fixed interval sampling | intervalStartingPoint |
evaluation()
function:The evaluation()
function takes a sample data frame or summary statistics about an evaluated audit sample and calculates a confidence bound according to a specified method. The returned jfaEvalution
object has a print()
and plot()
method. In the evaluation()
function, the prior
argument can be an object of class jfaPrior
as returned by the auditPrior()
function.
Full function with default arguments:
Supported options for the method
argument:
method |
Reference | Description | Additional arguments |
---|---|---|---|
binomial |
Stewart (2012) | Binomial likelihood | |
poisson |
Stewart (2012) | Poisson likelihood | |
hypergeometric |
Stewart (2012) | Hypergeometric likelihood | |
stringer |
Bickel (1992) | Classical Stringer bound | |
stringer-meikle |
Meikle (1972) | Stringer bound with Meikle’s correction | |
stringer-lta |
Leslie, Teitlebaum, & Anderson (1979) | Stringer bound with LTA correction | |
stringer-pvz |
Pap and van Zuijlen (1996) | Modified Stringer bound | |
rohrbach |
Rohrbach (1993) | Rohrbach’s augmented variance estimator | rohrbachDelta |
moment |
Dworin and Grimlund (1984) | Modified moment bound | momentPoptype |
coxsnell |
Cox and Snell (1979) | Cox and Snell bound |
csA , csB , and csMu
|
direct |
Touw and Hoogduin (2011) | Direct estimator | populationBookValue |
difference |
Touw and Hoogduin (2011) | Difference estimator | populationBookValue |
quotient |
Touw and Hoogduin (2011) | Quotient estimator | populationBookValue |
regression |
Touw and Hoogduin (2011) | Regression estimator | populationBookValue |
report()
function:The report()
function takes an object of class jfaEvaluation
as returned by the evaluation()
function, automatically generates a html
or pdf
report containing the analysis results and their interpretation, and saves the report to your local computer.
Full function with default arguments:
report(object = NULL, file = NULL, format = "html_document")
For an example report, see the following link.