Learn R Programming

jfa (version 0.5.7)

jfa-package: jfa --- Bayesian and Classical Audit Sampling

Description

logo

jfa is an R package for statistical audit sampling. The package provides functions for planning, performing, evaluating, and reporting an audit sample. Specifically, these functions implement standard audit sampling techniques for calculating sample sizes, selecting items from a population, and evaluating the misstatement from a data sample or from summary statistics. Additionally, the jfa package allows the user to create a prior probability distribution to perform Bayesian audit sampling using these functions.

The package and its intended workflow are also implemented with a graphical user interface in the Audit module of JASP, a free and open-source statistical software program.

For documentation on jfa itself, including the manual and user guide for the package, worked examples, and other tutorial information visit the package website.

Arguments

Reference tables

Below you can find several links to reference tables that contain statistical sample sizes, upper limits, and Bayes factors. These tables are created using the planning() and evaluation() functions provided in the package. See the corresponding help files for more information about these functions and how to replicate this output.

Sample sizes

Upper limits

Bayes factors

See Also

Useful links:

  • The cheat sheet for a quick overview of the intended workflow.

  • The vignettes for worked examples.

  • The issue page to submit a bug report or feature request.

Examples

Run this code
# NOT RUN {
# Load the jfa package
library(jfa)

# Load the BuildIt population
data("BuildIt")

############################################
### Example 1: Classical audit sampling ####
############################################

# Stage 1: Planning
stage1 <- planning(materiality = 0.03, expectedError = 0.01, 
                   likelihood = "poisson", confidence = 0.95)
summary(stage1)

# Stage 2: Selection
stage2 <- selection(population = BuildIt, sampleSize = stage1,
                    units = "mus", bookValues = "bookValue",
                    algorithm = "interval", intervalStartingPoint = 1)
summary(stage2)

# Stage 3: Execution
sample <- stage2[["sample"]]

# Stage 4: Evaluation
stage4 <- evaluation(materiality = 0.03, method = "stringer",
                     confidence = 0.95, sample = sample,
                     bookValues = "bookValue", auditValues = "auditValue")
summary(stage4)

######################################################################
### Example 2: Bayesian audit sampling using a non-informed prior ####
######################################################################

# Create the prior distribution
prior <- auditPrior(method = "none", likelihood = "poisson")
summary(prior)

# Stage 1: Planning
stage1 <- planning(materiality = 0.03, expectedError = 0.01,
                   likelihood = "poisson", confidence = 0.95, prior = prior)
summary(stage1)

# Stage 2: Selection
stage2 <- selection(population = BuildIt, sampleSize = stage1,
                    units = "mus", bookValues = "bookValue",
                    algorithm = "interval", intervalStartingPoint = 1)
summary(stage2)

# Stage 3: Execution
sample <- stage2[["sample"]]

# Stage 4: Evaluation
stage4 <- evaluation(materiality = 0.03, confidence = 0.95, sample = sample,
                     bookValues = "bookValue", auditValues = "auditValue",
                     prior = prior)
summary(stage4)

###################################################################
### Example 3: Bayesian audit sampling using an informed prior ####
###################################################################

# Create the prior distribution
prior <- auditPrior(method = "arm", likelihood = "poisson",
                    expectedError = 0.01, materiality = 0.03, cr = 0.6)
summary(prior)

# Stage 1: Planning
stage1 <- planning(materiality = 0.03, expectedError = 0.01,
                   likelihood = "poisson", confidence = 0.95, prior = prior)
summary(stage1)

# Stage 2: Selection
stage2 <- selection(population = BuildIt, sampleSize = stage1,
                    units = "mus", bookValues = "bookValue",
                    algorithm = "interval", intervalStartingPoint = 1)
summary(stage2)

# Stage 3: Execution
sample <- stage2[["sample"]]

# Stage 4: Evaluation
stage4 <- evaluation(materiality = 0.03, confidence = 0.95, sample = sample,
                     bookValues = "bookValue", auditValues = "auditValue",
                     prior = prior)
summary(stage4)
# }

Run the code above in your browser using DataLab