# NOT RUN {
library(jfa)
set.seed(1)
# Generate some audit data (N = 1000).
population <- data.frame(ID = sample(1000:100000, size = 1000, replace = FALSE),
bookValue = runif(n = 1000, min = 700, max = 1000))
# Draw a custom sample of 100 from the population (via random record sampling):
s1 <- sampling(population = population, sampleSize = 100, algorithm = "random",
units = "records", seed = 1)
print(s1)
# ------------------------------------------------------------
# jfa Selection Summary
# ------------------------------------------------------------
# Input:
#
# Population size: 1000
# Requested sample size: 100
# Sampling units: Records
# Algorithm: Random sampling
# ------------------------------------------------------------
# Output:
#
# Obtained sample size: 100
# ------------------------------------------------------------
# Statistics:
#
# Proportion n/N: 0.1
# ------------------------------------------------------------
# Use the result from the planning stage in the sampling stage:
p1 <- planning(materiality = 0.05, confidence = 0.95, expectedError = 0.025,
likelihood = "binomial")
# Draw a sample via random monetary unit sampling:
s2 <- sampling(population = population, sampleSize = p1, algorithm = "random",
units = "mus", seed = 1, bookValues = "bookValue")
print(s2)
# ------------------------------------------------------------
# jfa Selection Summary
# ------------------------------------------------------------
# Input:
#
# Population size: 1000
# Requested sample size: 234
# Sampling units: Monetary units
# Algorithm: Random sampling
# ------------------------------------------------------------
# Output:
#
# Obtained sample size: 234
# ------------------------------------------------------------
# Statistics:
#
# Proportion n/N: 0.23
# Percentage of value: 23.06%
# ------------------------------------------------------------
# }
Run the code above in your browser using DataLab