# 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