Learn R Programming

⚠️There's a newer version (0.7.3) of this package.Take me there.

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 audit sampling, selecting the transactions according to standard auditing techniques, and calculating various confidence bounds for the misstatement from the sample or from summary statistics. The package also allows the user to create a Bayesian prior probability 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.

Authors

  • Koen Derks - Initial work - Website

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

License

This project is licensed under the GPL-3 License.

Installing

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

Prerequisites

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

Downloading

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

install.packages("jfa")

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

library(jfa)

Examples can be found in the package vignette.

Contributing

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 appreciate. Contributing to jfa does not have to take much time or knowledge, and there is extensive information available on the Wiki page 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.

Benchmarks

jfa is verified against the following benchmarks:

Functions and features

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

Creating a prior distribution:

  • Function: auditPrior()

This 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.

auditPrior(confidence = 0.95, likelihood = "binomial", method = "none", expectedError = 0, N = NULL, materiality = NULL, ir = 1, cr = 1, pHmin = NULL, pHplus = NULL, factor = 1, sampleN = 0, sampleK = 0)

Supported features:

likelihoodDescription
binomial (default)The binomial likelihood and beta prior distribution
poissonThe Poisson likelihood and gamma prior distribution
hypergeometricThe hypergeometric likelihood and beta-binomial prior distribution
methodDescription
none (default)No prior information incorporated
armRisk assessments from the Audit Risk Model using ir and cr
medianEqual prior probabilities for (in)tolerable misstatement
hypothesesCustom prior probabilities for (in)tolerable misstatement using pHmin and pHplus
sampleEarlier sample using sampleN and sampleK
factorWeighted earlier sample using factor, sampleN and sampleK

Planning an audit sample:

  • Function: 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(confidence = 0.95, expectedError = 0, likelihood = "poisson", N = NULL, materiality = NULL, minPrecision = NULL, prior = FALSE, kPrior = 0, nPrior = 0, increase = 1, maxSize = 5000)

Supported features:

likelihoodDescription
binomial (default)The binomial likelihood and (optionally) the beta prior distribution
poissonThe Poisson likelihood and (optionally) the gamma prior distribution
hypergeometricThe hypergeometric likelihood and (optionally) the beta-binomial prior distribution

Selecting transactions from a population:

  • Function: selection()

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

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

Supported features:

unitsDescription
records (default)Record sampling; sampling units are transactions
musMonetary unit sampling; sampling units are monetary units
algorithmDescription
random (default)Random sampling
cellCell sampling
intervalSystematic sampling / Fixed interval sampling

Evaluating an audit sample:

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.

  • Function: evaluation()

evaluation(confidence = 0.95, method = "binomial", N = NULL, sample = NULL, bookValues = NULL, auditValues = NULL, counts = NULL, nSumstats = NULL, kSumstats = NULL, materiality = NULL, minPrecision = NULL, prior = FALSE, nPrior = 0, kPrior = 0, rohrbachDelta = 2.7, momentPoptype = "accounts", populationBookValue = NULL, csA = 1, csB = 3, csMu = 0.5)

Supported features:

methodDescription
binomial (default)The binomial likelihood and (optionally) the beta distribution
poissonThe Poisson likelihood and (optionally) the gamma distribution
hypergeometricThe hypergeometric likelihood and (optionally) the beta-binomial distribution
stringerThe Stringer bound
stringer-meikleStringer bound with Meikle's correction for understatements
stringer-ltaStringer bound with LTA correction for understatements
rohrbachRohrbach's augmented variance estimator
momentModified moment bound
coxsnellCox and Snell posterior bound
directThe direct estimator
differenceThe difference estimator
quotientThe quotient estimator
regressionThe regression estimator

Poster

Copy Link

Version

Install

install.packages('jfa')

Monthly Downloads

318

Version

0.4.0

License

GPL-3

Maintainer

Koen Derks

Last Published

October 30th, 2020

Functions in jfa (0.4.0)

BuildIt

BuildIt Construction financial statements
sampling

Sampling from Audit Populations
selection

Selecting a Sample from an Audit Population
planning

Frequentist and Bayesian Planning for Audit Sampling
evaluation

Evaluation of Audit Samples using Confidence / Credible Bounds
auditPrior

Create a Prior Distribution with Existing Audit Information