Skip to content
Bayesian and Classical Audit Sampling
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
R Do a small update to the poisson calculation to be consistent with th… Jan 3, 2020
tests Apparently this unit test acts weird Jan 7, 2020
vignettes jfa version 0.1.0 (#9) Dec 14, 2019
.Rbuildignore submitted package to CRAN Dec 14, 2019
.gitignore jfa version 0.1.0 (#9) Dec 14, 2019
NAMESPACE jfa version 0.1.0 (#9) Dec 14, 2019 Include grand total download badge Jan 12, 2020

Travis build status Coverage Release DownloadsMonthly DownloadsTotal Issues

R package jfa

jfa is a multi-functional R package for statistical auditing. The package provides the user with four generic functions for planning, performing, and evaluating an audit and its results. Specifically, it contains functions for calculating sample sizes for substantive testing, sampling from data according to standard auditing techniques, and calculating various confidence bounds for the maximum error from data or summary statistics. The package also allows the user to create a Bayesian prior distribution for use in these functions. The jfa package can be used to set up the entire audit sampling workflow.

For complete documentation, see the package manual.


  • Koen Derks - Initial work - Website

See also the list of contributors who participated in this project.


This project is licensed under the GPL-3 License.


These instructions will get you a copy of the jfa package up and running on your local machine for use in R and RStudio.


  • R - The programming language used for deploying the package.


R package jfa is simple to download and set-up. The live version from CRAN can be downloaded by running the following command in R:


The jfa package can then be loaded in RStudio by typing:


Examples can be found in the package vignette.


Below is a list of the available functions in the current development version of jfa, sorted by their occurrence in the standard audit sampling workflow.

auditPrior: Creating a prior distribution for substantive testing

  • auditPrior()

This function creates a prior distribution according to 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.

auditPrior(materiality, confidence = 0.95, method = "arm", ir = 1, cr = 1, expectedError = 0, likelihood = "binomial", N = NULL)

Planning: Calculating an audit sample size

  • planning()

This function calculates the required sample size for an audit, 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.

planning(materiality = NULL, confidence = 0.95, expectedError = 0, distribution = "poisson" N = NULL, maxSize = 5000, prior = FALSE, kPrior = 0, nPrior = 0)

Sampling: Selecting transactions from a population

  • sampling()

This 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 jfaSampling object has a print() and a plot() method. The sampleSize argument can also be an object of class jfaPlanning.

sampling(population, sampleSize, bookValues = NULL, algorithm = "random", units = "record", intervalStartingPoint = 1, ordered = TRUE, ascending = TRUE, withReplacement = FALSE, seed = 1)

Evaluation: Calculating confidence bounds for audit samples

This 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() functions.

  • evaluation()

evaluation(sample = NULL, bookValues = NULL, auditValues = NULL, confidence = 0.95, dataType = "sample", sampleSize = NULL, sumErrors = NULL, method = "binomial", materiality = NULL, N = NULL, rohrbachDelta = 2.7)


You can’t perform that action at this time.