diff --git a/DESCRIPTION b/DESCRIPTION index 38d301375..2d84e8a9f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,7 +11,7 @@ Authors@R: Description: Implements the audit sampling workflow as discussed in Derks et al. (2019) . The package makes it easy for an auditor to plan an audit sample, sample from the population, and evaluating that sample using various confidence bounds according to the International Standards on Auditing. Furthermore, the package implements Bayesian equivalents of these methods. BugReports: https://github.com/koenderks/jfa/issues URL: https://github.com/koenderks/jfa, https://koenderks.github.io/jfa/ -Suggests: testthat, knitr, rmarkdown +Suggests: testthat, knitr, rmarkdown, kableExtra Language: en-US License: GPL-3 Encoding: UTF-8 diff --git a/NAMESPACE b/NAMESPACE index a958ce3d8..ffea91a96 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -13,4 +13,5 @@ S3method(print,jfaSelection) export(auditPrior) export(evaluation) export(planning) +export(report) export(selection) diff --git a/NEWS.md b/NEWS.md index 678186545..df1c13578 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # jfa 0.5.0 +- Add a function `report()` that automatically generates an audit report. - Removed the `sampling()` function, which is now replaced entirely with the `selection()` function. - Changed the output of the `evaluation()` function when an estimator is used. diff --git a/R/evaluation.R b/R/evaluation.R index a1043ac94..eb9bec1d3 100644 --- a/R/evaluation.R +++ b/R/evaluation.R @@ -83,6 +83,7 @@ #' \item{populationK}{the assumed total errors in the population. Used in inferences with \code{hypergeometric} method.} #' \item{prior}{an object of class 'jfaPrior' to represents the prior distribution.} #' \item{posterior}{an object of class 'jfaPosterior' to represents the posterior distribution.} +#' \item{data}{a data frame containing the relevant columns from the \code{sample} input.} #' #' @author Koen Derks, \email{k.derks@nyenrode.nl} #' @@ -357,10 +358,10 @@ evaluation <- function(confidence = 0.95, method = "binomial", N = NULL, result[["mle"]] <- as.numeric(mle) if(!is.null(precision)) result[["precision"]] <- as.numeric(precision) + if(!is.null(populationBookValue)) + result[["popBookvalue"]] <- as.numeric(populationBookValue) if(method %in% c("direct", "difference", "quotient", "regression")){ # These methods yield an interval instead of a bound - result[["popBookvalue"]] <- as.numeric(populationBookValue) - result[["pointEstimate"]] <- as.numeric(out[["pointEstimate"]]) result[["lowerBound"]] <- as.numeric(out[["lowerBound"]]) result[["upperBound"]] <- as.numeric(out[["upperBound"]]) } else { @@ -377,12 +378,17 @@ evaluation <- function(confidence = 0.95, method = "binomial", N = NULL, result[["populationK"]] <- as.numeric(populationK) # Produce relevant conclusions conditional on the analysis result approvePrecision <- TRUE - if(minPrecision != 1) - approvePrecision <- result[["precision"]] <= minPrecision + if(minPrecision != 1){ + if(method %in% c("direct", "difference", "quotient", "regression")){ + approvePrecision <- (result[["precision"]] / populationBookValue) < minPrecision + } else { + approvePrecision <- result[["precision"]] < minPrecision + } + } approveMateriality <- TRUE if(materiality != 1){ if(method %in% c("direct", "difference", "quotient", "regression")){ - approveMateriality <- populationBookValue <= result[["upperBound"]] && populationBookValue >= result[["lowerBound"]] + approveMateriality <- (result[["upperBound"]] / populationBookValue) < materiality } else { approveMateriality <- result[["confBound"]] < materiality } @@ -466,6 +472,16 @@ evaluation <- function(confidence = 0.95, method = "binomial", N = NULL, # Add class 'jfaPosterior' to the posterior distribution object. class(result[["posterior"]]) <- "jfaPosterior" } + if(!is.null(sample)){ + indexa <- which(colnames(sample) == auditValues) + indexb <- which(colnames(sample) == bookValues) + frame <- as.data.frame(sample[, c(indexb, indexa)]) + frame <- cbind(as.numeric(rownames(frame)), frame) + frame[["difference"]] <- frame[, 2] - frame[, 3] + frame[["taint"]] <- frame[, 4] / frame[, 2] + colnames(frame) <- c("Row", bookValues, auditValues, "Difference", "Taint") + result[["data"]] <- frame + } # Add class 'jfaEvaluation' to the result. class(result) <- "jfaEvaluation" return(result) diff --git a/R/hidden.R b/R/hidden.R index a3cd124fc..7c3bac619 100644 --- a/R/hidden.R +++ b/R/hidden.R @@ -180,7 +180,7 @@ print.jfaEvaluation <- function(x, digits = 2, ...){ # ------------------------------------------------------------ # Output: # -# Most likely error: ", round(x[["pointEstimate"]], digits), " +# Most likely error: ", round(x[["mle"]], digits), " # Lower bound: ", round(x[["lowerBound"]], digits)," # Upper bound: ", round(x[["upperBound"]], digits)," # Precision: ", round(x[["precision"]], digits)," @@ -382,13 +382,23 @@ plot.jfaEvaluation <- function(x, ...){ if(x[["method"]] %in% c("stringer", "stringer-meikle", "stringer-lta", "stringer-pvz", "rohrbach", "moment", "coxsnell")) stop("No plotting method available for a confidence bound from this method.") if(x[["method"]] %in% c("direct", "difference", "quotient", "regression")){ - ymin <- x[["lowerBound"]] - (x[["pointEstimate"]] - x[["lowerBound"]]) - ymax <- x[["upperBound"]] + (x[["upperBound"]] - x[["pointEstimate"]]) - ticks <- pretty(ymin, ymax, min.n = 5) - graphics::plot(x = 0, y = x[["pointEstimate"]], bty = "n", cex = 2, pch = 19, xlab = "Population book value", ylab = "", ylim = c(min(ticks), max(ticks)), xlim = c(-0.1, 0.1), axes = FALSE) - graphics::arrows(x0 = 0, x1 = 0, y0 = x[["lowerBound"]], y1 = x[["upperBound"]], code = 3, lwd = 2, col = "black", angle = 90) - graphics::axis(2, at = ticks, las = 1) - graphics::abline(h = x[["popBookvalue"]], lty = 2) + ymin <- x[["mle"]] - 2 * x[["precision"]] + ymax <- x[["mle"]] + 2 * x[["precision"]] + graphics::plot(0, type = "n", ylim = c(ymin, ymax), ylab = expression(E), xlim = c(0, 1), bty = "n", xaxt = "n", xlab = "", yaxt = "n", main = paste0(round(x[["confidence"]] * 100, 2), "% Confidence interval")) + yBreaks <- base::pretty(c(ymin, ymax), n = 6) + graphics::axis(side = 2, at = yBreaks, labels = base::format(round(yBreaks), scientific = F, big.mark = ","), las = 1) + graphics::segments(x0 = 0, x1 = 1, y0 = 0, y1 = 0, lty = 2, col = "gray") + if(x[["materiality"]] != 1) + graphics::segments(x0 = 0, x1 = 1, y0 = (x[["popBookvalue"]] * x[["materiality"]]), y1 = (x[["popBookvalue"]] * x[["materiality"]]), lty = 2, col = "red") + graphics::points(x = 0.5, y = x[["mle"]], pch = 19) + graphics::arrows(x0 = 0.5, x1 = 0.5, y0 = x[["lowerBound"]], y1 = x[["upperBound"]], code = 3, lwd = 2, col = "black", angle = 90) + graphics::text(x = 0.86, y = x[["mle"]], labels = paste0("Most likely error = ", format(round(x[["mle"]], 2), scientific = FALSE, big.mark = ",")), cex = 0.75, adj = c(1, 0.5)) + graphics::text(x = 0.87, y = x[["lowerBound"]], labels = paste0("Lower bound = ", format(round(x[["lowerBound"]], 2), scientific = FALSE, big.mark = ",")), cex = 0.75, adj = c(1, 0.5)) + graphics::text(x = 0.87, y = x[["upperBound"]], labels = paste0("Upper bound = ", format(round(x[["upperBound"]], 2), scientific = FALSE, big.mark = ",")), cex = 0.75, adj = c(1, 0.5)) + graphics::segments(x0 = 0.40, x1 = 0.40, y0 = x[["mle"]], y1 = x[["upperBound"]], col = "black") + graphics::segments(x0 = 0.40, x1 = 0.42, y0 = x[["mle"]], y1 = x[["mle"]], col = "black") + graphics::segments(x0 = 0.40, x1 = 0.42, y0 = x[["upperBound"]], y1 = x[["upperBound"]], col = "black") + graphics::text(x = 0.15, y = (x[["upperBound"]] - x[["precision"]]/2), labels = paste0("Precision = ", format(round(x[["precision"]], 2), scientific = FALSE, big.mark = ",")), cex = 0.75, adj = c(0, 0.5)) } else { limx <- length(0:x[["n"]]) if(limx > 51){ diff --git a/R/internal.R b/R/internal.R index 901f1b207..72274f56b 100644 --- a/R/internal.R +++ b/R/internal.R @@ -17,4 +17,13 @@ # .dCoxAndSnellF <- function(x, df1, df2, multiplicationFactor){ # # Rewritten using Wolfram Mathematica # (df1 ** (df1 / 2) * df2**(df2 / 2) * (x / multiplicationFactor) ** (- 1 + df1 / 2) * (df2 + (df1 * x) / multiplicationFactor)**(( -df1 - df2) / 2))/(abs(multiplicationFactor) * beta(df1/2, df2/2)) -# } \ No newline at end of file +# } + +.getfun<-function(x) { + if(length(grep("::", x))>0) { + parts<-strsplit(x, "::")[[1]] + getExportedValue(parts[1], parts[2]) + } else { + x + } +} \ No newline at end of file diff --git a/R/report.R b/R/report.R new file mode 100644 index 000000000..bf84defd2 --- /dev/null +++ b/R/report.R @@ -0,0 +1,63 @@ +#' Generate an Audit Report +#' +#' @description This function takes an object of class \code{jfaEvaluation}, creates a report containing the results, and saves the report to a file in your working directory. +#' +#' For more details on how to use this function see the package vignette: +#' \code{vignette("jfa", package = "jfa")} +#' +#' @usage report(object = NULL, file = NULL, format = "html_document") +#' +#' @param object an object of class 'jfaEvaluation' as returned by the \code{evaluation()} function. +#' @param file a string that gives the desired name of the file (e.g. \code{"report.html"}). The report is created in your current working directory. +#' @param format can be either one of \code{"html_document"} or \code{"pdf_document"} (required MikTex). +#' +#' @return A html or pdf report containing the results of the evaluation. +#' +#' @author Koen Derks, \email{k.derks@nyenrode.nl} +#' +#' @seealso \code{\link{evaluation}} +#' +#' @examples +#' library(jfa) +#' set.seed(1) +#' +#' # Generate some audit data (N = 1000): +#' data <- data.frame(ID = sample(1000:100000, size = 1000, replace = FALSE), +#' bookValue = runif(n = 1000, min = 700, max = 1000)) +#' +#' # Using monetary unit sampling, draw a random sample from the population. +#' s1 <- selection(population = data, sampleSize = 100, units = "mus", +#' bookValues = "bookValue", algorithm = "random") +#' s1_sample <- s1$sample +#' s1_sample$trueValue <- s1_sample$bookValue +#' s1_sample$trueValue[2] <- s1_sample$trueValue[2] - 500 # One overstatement is found +#' +#' e2 <- evaluation(sample = s1_sample, bookValues = "bookValue", auditValues = "trueValue", +#' method = "stringer", materiality = 0.05, counts = s1_sample$counts) +#' +#' # Generate report +#' # report(e2, file = "myFile.html") +#' +#' @keywords evaluation report audit +#' +#' @export + +report <- function(object = NULL, file = NULL, format = "html_document"){ + + if(!class(object) == "jfaEvaluation") + stop("Object must be of class 'jfaEvaluation'.") + + #Determine the template + theFile <- system.file("rmd/report.Rmd", package = "jfa") + + #Process the Arguments + args <- list() + args$input <- theFile + args$output_dir <- getwd() + args$output_format <- format + args$output_file <- file + + #Run the render + outputFileName <- do.call(.getfun('rmarkdown::render'), args = args) + invisible(outputFileName) +} \ No newline at end of file diff --git a/README.Rmd b/README.Rmd index 2afb97444..894cfb38b 100644 --- a/README.Rmd +++ b/README.Rmd @@ -82,6 +82,8 @@ library(jfa) ### Vignettes +The package vignettes contain explanations about the functionality of `jfa` illustated using simple examples. + * [Get started](https://koenderks.github.io/jfa/articles/jfa.html) * [The audit sampling workflow](https://koenderks.github.io/jfa/articles/v1auditWorkflow.html) * [Constructing a prior distribution](https://koenderks.github.io/jfa/articles/v2priorDistributions.html) @@ -104,6 +106,12 @@ If you are willing to contribute to the improvement of the package by adding a b Below is a list of the available functions in the current version of `jfa`, sorted by their occurrence in the standard audit sampling workflow. +* [`auditPrior()`](#create-a-prior-distribution-with-the-auditprior-function) +* [`planning()`](#plan-a-sample-with-the-planning-function) +* [`selection()`](#select-transactions-with-the-selection-function) +* [`evaluation()`](#evaluate-a-sample-with-the-evaluation-function) +* [`report()`](#generate-a-report-with-the-report-function) + ### Create a prior distribution with the `auditPrior()` function: The `auditPrior()` 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. @@ -197,9 +205,19 @@ The `evaluation()` function takes a sample data frame or summary statistics abou | `quotient` | Touw and Hoogduin (2011) | Quotient estimator | `populationBookValue` | | `regression` | Touw and Hoogduin (2011) | Regression estimator | `populationBookValue` | +### Generate a report with the `report()` function: + +The `report()` function takes an object of class `jfaEvaluation` as returned by the `evaluation()` function, automatically generates a `html` or `pdf` report containing the analysis results and their interpretation, and saves the report to your local computer. + +*Full function with default arguments:* + +`report(object = NULL, file = NULL, format = "html_document")` + +For an example report, see the following [link](https://github.com/koenderks/jfa/tree/master/man/figures/readme/report/report.pdf). + ## References -- Bickel, P. J. (1992). Inference and auditing: The Stringer Bound. *International Statistical Review*, 60(2), 197–209. - [View online](https://www.jstor.org/stable/1403650) +- Bickel, P. J. (1992). Inference and auditing: The Stringer bound. *International Statistical Review*, 60(2), 197–209. - [View online](https://www.jstor.org/stable/1403650) - Cox, D. R., & Snell, E. J. (1979). On sampling and the estimation of rare errors. *Biometrika*, 66(1), 125-132. - [View online](https://doi.org/10.1093/biomet/66.1.125) - Derks, K. (2020). jfa: Bayesian and classical audit sampling. R package version 0.4.0. - [View online](https://cran.r-project.org/package=jfa) - Derks, K., de Swart, J., van Batenburg, P., Wagenmakers, E.-J., & Wetzels, R. (2020). Priors in a Bayesian audit: How integration of existing information into the prior distribution can improve audit transparency and efficiency. *Under review*. - [View online](https://psyarxiv.com/8fhkp/) diff --git a/README.md b/README.md index f0aec3bce..d653c4e40 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,9 @@ The `jfa` package can then be loaded in R or RStudio by typing: ### Vignettes +The package vignettes contain explanations about the functionality of +`jfa` illustated using simple examples. + - [Get started](https://koenderks.github.io/jfa/articles/jfa.html) - [The audit sampling workflow](https://koenderks.github.io/jfa/articles/v1auditWorkflow.html) @@ -129,6 +132,12 @@ Below is a list of the available functions in the current version of `jfa`, sorted by their occurrence in the standard audit sampling workflow. + - [`auditPrior()`](#create-a-prior-distribution-with-the-auditprior-function) + - [`planning()`](#plan-a-sample-with-the-planning-function) + - [`selection()`](#select-transactions-with-the-selection-function) + - [`evaluation()`](#evaluate-a-sample-with-the-evaluation-function) + - [`report()`](#generate-a-report-with-the-report-function) + ### Create a prior distribution with the `auditPrior()` function: The `auditPrior()` function creates a prior distribution according to @@ -254,9 +263,23 @@ FALSE, nPrior = 0, kPrior = 0, rohrbachDelta = 2.7, momentPoptype = | `quotient` | Touw and Hoogduin (2011) | Quotient estimator | `populationBookValue` | | `regression` | Touw and Hoogduin (2011) | Regression estimator | `populationBookValue` | +### Generate a report with the `report()` function: + +The `report()` function takes an object of class `jfaEvaluation` as +returned by the `evaluation()` function, automatically generates a +`html` or `pdf` report containing the analysis results and their +interpretation, and saves the report to your local computer. + +*Full function with default arguments:* + +`report(object = NULL, file = NULL, format = "html_document")` + +For an example report, see the following +[link](https://github.com/koenderks/jfa/tree/master/man/figures/readme/report/report.pdf). + ## References - - Bickel, P. J. (1992). Inference and auditing: The Stringer Bound. + - Bickel, P. J. (1992). Inference and auditing: The Stringer bound. *International Statistical Review*, 60(2), 197–209. - [View online](https://www.jstor.org/stable/1403650) - Cox, D. R., & Snell, E. J. (1979). On sampling and the estimation of diff --git a/cran-comments.md b/cran-comments.md index 04d0d3ba7..c5493b8ee 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,7 +1,9 @@ ## This is a submission for version 0.5.0 This is jfa version 0.5.0. In this version I have: +* Added a report function. * Deprecated the sampling function. +* Extended unit tests. ## Test environments * OS X install (on travis-ci), R release diff --git a/inst/rmd/empty.png b/inst/rmd/empty.png new file mode 100644 index 000000000..b2fdbab62 Binary files /dev/null and b/inst/rmd/empty.png differ diff --git a/inst/rmd/jfaLogo.png b/inst/rmd/jfaLogo.png new file mode 100644 index 000000000..a945e0f69 Binary files /dev/null and b/inst/rmd/jfaLogo.png differ diff --git a/inst/rmd/materiality_failed.png b/inst/rmd/materiality_failed.png new file mode 100644 index 000000000..116aea58a Binary files /dev/null and b/inst/rmd/materiality_failed.png differ diff --git a/inst/rmd/materiality_failed.svg b/inst/rmd/materiality_failed.svg new file mode 100644 index 000000000..23903383a --- /dev/null +++ b/inst/rmd/materiality_failed.svg @@ -0,0 +1,145 @@ + + + +image/svg+xml + + +MateMateriality + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/inst/rmd/materiality_succeeded.png b/inst/rmd/materiality_succeeded.png new file mode 100644 index 000000000..a544e9c11 Binary files /dev/null and b/inst/rmd/materiality_succeeded.png differ diff --git a/inst/rmd/materiality_succeeded.svg b/inst/rmd/materiality_succeeded.svg new file mode 100644 index 000000000..6e0ad9059 --- /dev/null +++ b/inst/rmd/materiality_succeeded.svg @@ -0,0 +1,144 @@ + + + +image/svg+xml + + +MateMateriality + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/inst/rmd/precision_failed.png b/inst/rmd/precision_failed.png new file mode 100644 index 000000000..395066385 Binary files /dev/null and b/inst/rmd/precision_failed.png differ diff --git a/inst/rmd/precision_failed.svg b/inst/rmd/precision_failed.svg new file mode 100644 index 000000000..864bcc9b9 --- /dev/null +++ b/inst/rmd/precision_failed.svg @@ -0,0 +1,145 @@ + + + +image/svg+xml + + +MatePrecision + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/inst/rmd/precision_succeeded.png b/inst/rmd/precision_succeeded.png new file mode 100644 index 000000000..ac31a99ae Binary files /dev/null and b/inst/rmd/precision_succeeded.png differ diff --git a/inst/rmd/precision_succeeded.svg b/inst/rmd/precision_succeeded.svg new file mode 100644 index 000000000..22efb996f --- /dev/null +++ b/inst/rmd/precision_succeeded.svg @@ -0,0 +1,144 @@ + + + +image/svg+xml + + +MatePrecision + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/inst/rmd/report.Rmd b/inst/rmd/report.Rmd new file mode 100644 index 000000000..20bb86948 --- /dev/null +++ b/inst/rmd/report.Rmd @@ -0,0 +1,223 @@ +--- +title: "Audit sampling report" +output: + html_document: + theme: journal +--- + +```{r, include = FALSE} +colorize <- function(x, color) { + if (knitr::is_latex_output()) { + sprintf("\\textcolor{%s}{%s}", color, x) + } else if (knitr::is_html_output()) { + sprintf("%s", color, + x) + } else x +} +``` + +```{css, echo=FALSE} +.math { + font-size: small; +} +``` + +--- + +logo + +This report was created by `r version$version.string` and its package `jfa` (version `r utils::packageVersion("jfa")`)^[`jfa`'s source code can be found on its [GitHub page](https://github.com/koenderks/jfa)]. `jfa` provides Bayesian and classical audit sampling analyses and is available on CRAN. + +`jfa` is free software and you can redistribute it and or modify it under the terms of the GNU GPL-3 as published by the Free Software Foundation. The package is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability of fitness for a particular purpose. + +Visit the [package website](https://koenderks.github.io/jfa) to learn more! + +### Summary + +--- + + +`r if(object[["materiality"]] != 1 & object[["minPrecision"]] != 1){ paste0("The objective of this sampling procedure is to determine with a confidence of ", round(object[["confidence"]] * 100, 3), "% whether the percentage of misstatement in the population is lower than the performance materiality of ", round(object[["materiality"]] * 100, 3), "% ",if(!is.null(object[["popBookvalue"]])){paste0("( = $", format(round(object[["popBookvalue"]] * object[["materiality"]], 3), scientific = FALSE, big.mark = ","),")")} else {}," with a required minimum precision of ", round(object[["minPrecision"]] * 100, 3), "% ",if(!is.null(object[["popBookvalue"]])){paste0("( = $", format(round(object[["popBookvalue"]] * object[["minPrecision"]], 3), scientific = FALSE, big.mark = ","),")")} else {},".") } else if(object[["materiality"]] != 1 && object[["minPrecision"]] == 1){ paste0("The objective of this sampling procedure is to determine with a confidence of ", round(object[["confidence"]] * 100, 3), "% whether the percentage of misstatement in the population is lower than the performance materiality of ", round(object[["materiality"]] * 100, 3), "% ",if(!is.null(object[["popBookvalue"]])){paste0("( = $", format(round(object[["popBookvalue"]] * object[["materiality"]], 3), scientific = FALSE, big.mark = ","),")")} else {}) } else if(object[["materiality"]] == 1 && object[["minPrecision"]] != 1){ paste0("The objective of this sampling procedure is to determine the misstatement in the population with a confidence of ", round(object[["confidence"]] * 100, 3), "% and a minimum required precision of ", round(object[["minPrecision"]] * 100, 3), "% ",if(!is.null(object[["popBookvalue"]])){paste0("( = $", format(round(object[["popBookvalue"]] * object[["minPrecision"]], 3), scientific = FALSE, big.mark = ","),")")} else {},".") }` + +```{r echo=FALSE} +df <- data.frame("n" = object[["n"]], "k" = object[["k"]], "t" = object[["t"]]) +colnames(df) <- c("Sample size", "Deviations", "Total taint") +tab <- knitr::kable(df, digits = 2, caption = "Table 1: Summary of the sampling results.", format = "html", + row.names = FALSE, format.args = list(big.mark = ",", scientific = FALSE), + table.attr = "style='width:40%;'", align = "c") +if(is.nan(object[["t"]])) + tab <- kableExtra::footnote(tab, + alphabet = "The total taint could not be calculated because + some ist values are zero.", fixed_small_size = TRUE) +kableExtra::kable_classic(tab, position="float_left", html_font = "Cambria") +``` + +
+
+```{r, echo = FALSE} +if(object[["materiality"]] != 1){ + if(object[["method"]] %in% c("direct", "difference", "quotient", "regression")){ + if(object[["upperBound"]] < object[["materiality"]] * object[["popBookvalue"]]){ + knitr::include_graphics("./materiality_succeeded.png") + } else { + knitr::include_graphics("./materiality_failed.png") + } + } else { + if(object[["confBound"]] < object[["materiality"]]){ + knitr::include_graphics("./materiality_succeeded.png") + } else { + knitr::include_graphics("./materiality_failed.png") + } + } +} + +if(object[["materiality"]] != 1 & object[["minPrecision"]] != 1) + knitr::include_graphics("./empty.png") + +if(object[["minPrecision"]] != 1){ + if(object[["method"]] %in% c("direct", "difference", "quotient", "regression")){ + if(object[["precision"]] < object[["minPrecision"]] * object[["popBookvalue"]]){ + knitr::include_graphics("./precision_succeeded.png") + } else { + knitr::include_graphics("./precision_failed.png") + } + } else { + if(object[["precision"]] < object[["minPrecision"]]){ + knitr::include_graphics("./precision_succeeded.png") + } else { + knitr::include_graphics("./precision_failed.png") + } + } +} +``` +
+ +The table below summarizes the estimated misstatement in the population, including the most likely error, the `r round(object[["confidence"]] * 100, 3)`% upper bound, and the obtained precision. As a justification of these results, appendix A contains the derivations upon which they are based. Appendix B lists the input data. + +```{r, echo = FALSE} +if(object[["method"]] %in% c("direct", "difference", "quotient", "regression")){ + df <- data.frame("type" = c("x 100 = %", "$"), + "mle" = c(object[["mle"]]/object[["popBookvalue"]], object[["mle"]]), + "lb" = c(object[["lowerBound"]]/object[["popBookvalue"]], object[["lowerBound"]]), + "ub" = c(object[["upperBound"]]/object[["popBookvalue"]], object[["upperBound"]]), + "precision" = c(object[["precision"]]/object[["popBookvalue"]], object[["precision"]])) + colnames(df) <- c("", "Most likely error", "Lower bound", "Upper bound", "Precision") +} else { + if(!is.null(object[["popBookvalue"]])){ + df <- data.frame("type" = c("% = x 100", "$"), + "mle" = c(object[["mle"]], object[["mle"]] * object[["popBookvalue"]]), + "ub" = c(object[["confBound"]], object[["confBound"]] * object[["popBookvalue"]]), + "precision" = c(object[["precision"]], + object[["precision"]] * object[["popBookvalue"]])) + } else { + df <- data.frame("type" = c("% = x 100"), + "mle" = object[["mle"]], + "ub" = object[["confBound"]], + "precision" = object[["precision"]]) + } + colnames(df) <- c("", "Most likely error", "Upper bound", "Precision") +} +tab <- knitr::kable(df, digits = 3, caption = "Table 2: Summary of the inferential results.", format = "html", + row.names = FALSE, format.args = list(big.mark = ",", scientific = FALSE), + table.attr = "style='width:70%;'", align = "r") +tab <- kableExtra::footnote(tab, + alphabet = "The top row shows the misstatement as a fraction of the total value.", fixed_small_size = TRUE) +kableExtra::kable_classic(tab, position="left", html_font = "Cambria") +``` + +```{r echo=FALSE, fig.height=3.4, fig.align='center'} +if(!(object[["method"]]%in%c("stringer"))){ + plot(object) +} +``` + +\newpage + +### Appendix A: Derivations + +--- + +These results have been calculated using `r switch(object[["method"]], "poisson" = "the Poisson distribution", "binomial" = "the binomial distribution", "the hypergeometric" = "hypergeometric distribution", "stringer" = "the Stringer bound (Bickel, 1992)", "stringer-meikle" = "the Stringer bound with Meikle's correction", "stringer-lta" = "the Stringer bound with LTA correction", "stringer-pvz" = "the modified Stringer bound", "rohrbach" = "Rohrbach's augmented variance bound", "moment" = "the modified moment bound", "coxsnell" = "the Cox and Snell bound", "direct" = "the direct (mean per unit) estimator (Touw & Hoogduin, 2011)", "difference" = "the difference estimator (Touw & Hoogduin, 2011)", "quotient" = "the quotient estimator (Touw & Hoogduin, 2011)", "regression" = "the regression estimator (Touw & Hoogduin, 2011)")`. `r if(object[["method"]] %in% c("difference", "quotient", "direct", "regression")){"The units of inference are individual transactions"} else {"The units of inference are individual monetary units"}`. + +*Notation:* + + +`r if (object[["method"]] %in% c("direct", "regression")){ paste0("\\begin{equation}\\begin{split}\\text{Ist position: }& ist = \\text{", colnames(object[["data"]])[2], "} \\\\ \\text{Soll position: }& soll = \\text{", colnames(object[["data"]])[3], "} \\\\ \\text{Sample size: }& n = ", object[["n"]], " \\\\ \\text{Population size: }& N = ", format(object[["N"]], big.mark=","), "\\\\ \\text{Population value: }& B = ", format(object[["popBookvalue"]], digits = 3, scientific = FALSE, big.mark = ","), " \\\\ \\text{Sampling risk: }& \\alpha = ", round(1 - object[["confidence"]], 3), "\\end{split} \\hspace{4cm} \\begin{split} \\text{Estimated population misstatement: }& \\hat{E} \\\\ \\text{Lower bound population misstatement: }& E_{",round(1 - (object[["confidence"]] + ((1 - object[["confidence"]])/2)), 3),"} \\\\ \\text{Upper bound population misstatement: }& E_{",round(object[["confidence"]] + ((1 - object[["confidence"]])/2), 3),"} \\\\ \\text{Estimated unit true value: }& \\hat{\\theta} \\end{split}\\end{equation}") }` + + +`r if (object[["method"]] %in% c("difference", "quotient")){ paste0("\\begin{equation}\\begin{split}\\text{Ist position: }& ist = \\text{", colnames(object[["data"]])[2], "} \\\\ \\text{Soll position: }& soll = \\text{", colnames(object[["data"]])[3], "} \\\\ \\text{Sample size: }& n = ", object[["n"]], " \\\\ \\text{Population size: }& N = ", format(object[["N"]], big.mark=","), "\\\\ \\text{Population value: }& B = ", format(object[["popBookvalue"]], digits = 3, scientific = FALSE, big.mark = ","), " \\\\ \\text{Sampling risk: }& \\alpha = ", round(1 - object[["confidence"]], 3), "\\end{split} \\hspace{4cm} \\begin{split} \\text{Estimated population misstatement: }& \\hat{E} \\\\ \\text{Lower bound population misstatement: }& E_{",round(1 - (object[["confidence"]] + ((1 - object[["confidence"]])/2)), 3),"} \\\\ \\text{Upper bound population misstatement: }& E_{",round(object[["confidence"]] + ((1 - object[["confidence"]])/2), 3),"} \\\\ \\text{Estimated unit misstatement: }& \\hat{\\theta} \\end{split}\\end{equation}") }` + + +`r if (object[["method"]] %in% c("binomial", "stringer")){ paste0("\\begin{equation}\\begin{split}\\text{Ist position: }& ist = \\text{", colnames(object[["data"]])[2], "} \\\\ \\text{Soll position: }& soll = \\text{", colnames(object[["data"]])[3], "} \\\\ \\text{Sample size: }& n = ", object[["n"]], " \\\\ \\text{Misstatements: }& k = ", object[["k"]], "\\\\ \\text{Population value: }& B = ", format(object[["popBookvalue"]], digits = 3, scientific = FALSE, big.mark = ","), " \\\\ \\text{Sampling risk: }& \\alpha = ", round(1 - object[["confidence"]], 3), "\\end{split} \\hspace{4cm} \\begin{split} \\text{Estimated population misstatement: }& \\hat{E} \\\\ \\text{Upper bound population misstatement: }& E_{",round(object[["confidence"]], 3),"} \\\\ \\text{Estimated unit misstatement: }& \\hat{\\theta} \\\\ \\text{Upper bound unit misstatement: }& \\theta_{", round(object[["confidence"]], 3),"} \\end{split}\\end{equation}") }` + +*Calculation:* + +`r if (!(object[["method"]] %in% c("difference", "direct", "quotient", "regression", "binomial", "stringer"))){ "**No calculations are available for this method yet. Check back soon!**" }` + + +`r if (object[["method"]] == "direct"){ paste0("$\\begin{aligned} \\text{The estimated population misstatemen}&\\text{t } \\hat{E}\\text{ is a generalization of the estimated unit true value }\\hat{\\theta}\\text{:} \\\\ \\\\ \\hat{E} &= B - N \\times \\hat{\\theta} \\\\ &= ", format(object[["popBookvalue"]], digits = 3, scientific = F, big.mark=","), " - ", format(object[["N"]], scientific = F, big.mark=",")," \\times ", format(mean(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=",")," = ", format(object[["mle"]], nsmall = 2, scientific = F, big.mark=",")," \\\\ \\\\ \\text{The confidence interval for the populat}&\\text{ion misstatement } [E_{",round(1 - (object[["confidence"]] + ((1 - object[["confidence"]])/2)), 3),"}; E_{",round(object[["confidence"]] + ((1 - object[["confidence"]])/2), 3),"}] \\text{ is a generalization of the unit upper and lower bounds:} \\\\ \\\\ [E_{",round(1 - (object[["confidence"]] + ((1 - object[["confidence"]])/2)), 3),"}; E_{",round(object[["confidence"]] + ((1 - object[["confidence"]])/2), 3),"}] &= B - N \\times \\left( \\hat{\\theta} \\pm t_{1 - \\frac{\\alpha}{2}} \\times \\frac{s_{soll}}{\\sqrt{n}}\\right) \\\\ &= ", format(object[["popBookvalue"]], digits = 3, scientific = F, big.mark=","), " - ", format(object[["N"]], scientific = F, big.mark=","), "\\times \\left(", format(mean(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=",") ," \\pm ", format(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1) * (stats::sd(object[["data"]][, 3])/sqrt(object[["n"]])), nsmall = 2, scientific = F, big.mark=","),"\\right) = [", format(object[["lowerBound"]], nsmall = 2, scientific = F, big.mark=","),";",format(object[["upperBound"]], nsmall = 2, scientific = F, big.mark=",")," ] \\\\ \\\\ \\text{The other relevant quantities can be de}&\\text{rived using the following formulas:} \\\\ \\\\ \\hat{\\theta} &= \\bar{soll} = \\frac{\\sum_{i=1}^n soll_i}{n} = \\frac{", format(sum(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=","),"}{", object[["n"]] ,"} = ", format(mean(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=","), "\\\\ t_{1 - \\frac{\\alpha}{2}} &= t_{", round(object[["confidence"]] + ((1 - object[["confidence"]]) / 2), 3) ,"} = ", round(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1), 3) ,"\\\\ s_{soll} &= \\sqrt{\\frac{\\sum_{i=1}^n (soll_i - \\bar{soll})^2}{n - 1}} = \\sqrt{\\frac{", format(sum((object[["data"]][, 3] - mean(object[["data"]][, 3]))^2), nsmall = 2, scientific = F, big.mark=","),"}{", object[["n"]] - 1,"}} =", format(stats::sd(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=",") ,"\\\\ t_{", round(object[["confidence"]] + ((1 - object[["confidence"]]) / 2), 3) ,"} \\times \\frac{s_{soll}}{\\sqrt{n}} &= ", round(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1), 3)," \\times \\frac{", format(stats::sd(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=",") ,"}{\\sqrt{", object[["n"]],"}} = ",format(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1) * (stats::sd(object[["data"]][, 3])/sqrt(object[["n"]])), nsmall = 2, scientific = F, big.mark=",") ,"\\end{aligned}$") }` + + +`r if (object[["method"]] == "difference"){ paste0("$\\begin{aligned} \\text{The estimated population misstatemen}&\\text{t } \\hat{E}\\text{ is a generalization of the estimated unit misstatement }\\hat{\\theta}\\text{:} \\\\ \\\\ \\hat{E} &= N \\times \\hat{\\theta} \\\\ &= ", format(object[["N"]], scientific = F, big.mark=",")," \\times ", format(mean(object[["data"]][, 4]), nsmall = 2, scientific = F, big.mark=",")," = ", format(object[["N"]] * mean(object[["data"]][, 4]), nsmall = 2, scientific = F, big.mark=",") ," \\\\ \\\\ \\text{The confidence interval for the populat}&\\text{ion misstatement } [E_{",round(1 - (object[["confidence"]] + ((1 - object[["confidence"]])/2)), 3),"}; E_{",round(object[["confidence"]] + ((1 - object[["confidence"]])/2), 3),"}] \\text{ is a generalization of the unit upper and lower bounds:} \\\\ \\\\ [E_{",round(1 - (object[["confidence"]] + ((1 - object[["confidence"]])/2)), 3),"}; E_{",round(object[["confidence"]] + ((1 - object[["confidence"]])/2), 3),"}] &= N \\times \\left( \\hat{\\theta} \\pm t_{1 - \\frac{\\alpha}{2}} \\times \\frac{s_e}{\\sqrt{n}} \\right) \\\\ &= ", format(object[["N"]], scientific = F, big.mark=","), " \\times \\left(", format(mean(object[["data"]][, 4]), nsmall = 2, scientific = F, big.mark=",") ," \\pm ", format(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1) * (stats::sd(object[["data"]][, 4])/sqrt(object[["n"]])), nsmall = 2, scientific = F, big.mark=","),"\\right) = [", format(object[["lowerBound"]], nsmall = 2, scientific = F, big.mark=","),";",format(object[["upperBound"]], nsmall = 2, scientific = F, big.mark=",")," ] \\\\ \\\\ \\text{The other relevant quantities can be de}&\\text{rived using the following formulas:} \\\\ \\\\ \\hat{\\theta} &= \\frac{\\sum_{i=1}^n ist_i - soll_i}{n} = \\frac{", format(sum(object[["data"]][, 4]), nsmall = 2, scientific = F, big.mark=","),"}{", object[["n"]] ,"} = ", format(mean(object[["data"]][, 4]), nsmall = 2, scientific = F, big.mark=","), "\\\\ t_{1 - \\frac{\\alpha}{2}} &= t_{", round(object[["confidence"]] + ((1 - object[["confidence"]]) / 2), 3) ,"} = ", round(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1), 3) ,"\\\\ s_e &= \\sqrt{\\frac{\\sum_{i=1}^n ([ist_i - soll_i] - \\hat{\\theta})^2}{n - 1}} = \\sqrt{\\frac{", format(sum((object[["data"]][, 4] - mean(object[["data"]][, 4]))^2), nsmall = 2, scientific = F, big.mark=","),"}{", object[["n"]] - 1,"}} =", format(stats::sd(object[["data"]][, 4]), nsmall = 2, scientific = F, big.mark=","),"\\\\ t_{", round(object[["confidence"]] + ((1 - object[["confidence"]]) / 2), 3) ,"} \\times \\frac{s_e}{\\sqrt{n}} &= ", round(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1), 3)," \\times \\frac{", format(stats::sd(object[["data"]][, 4]), nsmall = 2, scientific = F, big.mark=","),"}{\\sqrt{", object[["n"]],"}} = ",format(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1) * (stats::sd(object[["data"]][, 4])/sqrt(object[["n"]])), nsmall = 2, scientific = F, big.mark=",") ,"\\end{aligned}$") }` + + +`r if (object[["method"]] == "quotient"){ paste0("$\\begin{aligned} \\text{The estimated population misstatemen}&\\text{t } \\hat{E}\\text{ is a generalization of the estimated unit misstatement }\\hat{\\theta}\\text{:} \\\\ \\\\ \\hat{E} &= N \\times \\hat{\\theta} \\\\ &= ", format(object[["N"]], scientific = F, big.mark=",")," \\times ", format(((1 - (mean(object[["data"]][, 3]) / mean(object[["data"]][, 2]))) * mean(object[["data"]][, 2])), nsmall = 2, scientific = F, big.mark=",") ," = ", format(object[["N"]] * ((1 - (mean(object[["data"]][, 3]) / mean(object[["data"]][, 2]))) * mean(object[["data"]][, 2])), nsmall = 2, scientific = F, big.mark=",")," \\\\ \\\\ \\text{The confidence interval for the populat}&\\text{ion misstatement } [E_{",round(1 - (object[["confidence"]] + ((1 - object[["confidence"]])/2)), 3),"}; E_{",round(object[["confidence"]] + ((1 - object[["confidence"]])/2), 3),"}] \\text{ is a generalization of the unit upper and lower bounds:} \\\\ \\\\ [E_{",round(1 - (object[["confidence"]] + ((1 - object[["confidence"]])/2)), 3),"}; E_{",round(object[["confidence"]] + ((1 - object[["confidence"]])/2), 3),"}] &= N \\times \\left( \\hat{\\theta} \\pm t_{1 - \\frac{\\alpha}{2}} \\times \\frac{s_q}{\\sqrt{n}} \\right) \\\\ &= ", format(object[["N"]], scientific = F, big.mark=","), "\\times \\left(", format(((1 - (mean(object[["data"]][, 3]) / mean(object[["data"]][, 2]))) * mean(object[["data"]][, 2])), nsmall = 2, scientific = F, big.mark=",")," \\pm ", format(object[["precision"]]/object[["N"]], nsmall = 2, scientific = F, big.mark=","),"\\right) = [", format(object[["lowerBound"]], nsmall = 2, scientific = F, big.mark=","),";",format(object[["upperBound"]], nsmall = 2, scientific = F, big.mark=",")," ]\\\\ \\\\ \\text{The other relevant quantities can be de}&\\text{rived using the following formulas:} \\\\ \\\\ \\hat{\\theta} &= (1 - q) \\times \\bar{ist} = (1 - ", format(mean(object[["data"]][, 3]) / mean(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=",") ,") \\times ",format(mean(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=",")," = ",format(((1 - (mean(object[["data"]][, 3]) / mean(object[["data"]][, 2]))) * mean(object[["data"]][, 2])), nsmall = 2, scientific = F, big.mark=","),"\\\\ q &= \\frac{\\bar{soll}}{\\bar{ist}} = \\frac{", format(mean(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=",") ,"}{", format(mean(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=",") ,"} = ", format(mean(object[["data"]][, 3]) / mean(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=",")," \\\\ \\bar{ist} &= \\frac{\\sum_{i=1}^n ist_i}{n} = \\frac{", format(sum(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=","),"}{", object[["n"]] ,"} = ", format(mean(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=","), "\\\\ \\bar{soll} &= \\frac{\\sum_{i=1}^n soll_i}{n} = \\frac{", format(sum(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=","),"}{", object[["n"]] ,"} = ", format(mean(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=","), "\\\\ t_{1 - \\frac{\\alpha}{2}} &= t_{", round(object[["confidence"]] + ((1 - object[["confidence"]]) / 2), 3) ,"} = ", round(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1), 3),"\\\\ r_{soll \\sim ist} &= Cor(ist, soll) = ", format(stats::cor(object[["data"]][, 2], object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=",")," \\\\ s_q &= \\sqrt{s_{soll}^2 - 2 \\times q \\times r_{soll \\sim ist} \\times s_{ist} \\times s_{soll} + q^2 \\times s_{ist}^2} \\\\ &= \\sqrt{", format(stats::var(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=",")," - 2 \\times ", format(mean(object[["data"]][, 3]) / mean(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=","), "\\times ", format(stats::cor(object[["data"]][, 2], object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=",")," \\times ", format(stats::sd(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=",")," \\times ", format(stats::sd(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=",")," + ", format(mean(object[["data"]][, 3]) / mean(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=","),"^2 \\times ",format(stats::sd(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=",")," } = ", format(sqrt(stats::var(object[["data"]][, 3]) - 2 * (mean(object[["data"]][, 3]) / mean(object[["data"]][, 2])) * stats::cor(object[["data"]][, 2], object[["data"]][, 3]) * stats::sd(object[["data"]][, 2]) * stats::sd(object[["data"]][, 3]) + (mean(object[["data"]][, 3]) / mean(object[["data"]][, 2]))^2 * stats::var(object[["data"]][, 2])), nsmall = 2, scientific = F, big.mark=","), " \\\\ s^2_{ist} &= \\frac{\\sum_{i=1}^n (ist_i - \\bar{ist})^2}{n - 1} = \\frac{", format(sum((object[["data"]][, 2] - mean(object[["data"]][, 2]))^2), nsmall = 2, scientific = F, big.mark=",") ,"}{", object[["n"]] - 1,"} =", format(stats::var(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=","),"\\\\ s_{ist} &= \\sqrt{s^2_{ist}} = ", format(stats::sd(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=",")," \\\\ s^2_{soll} &= \\frac{\\sum_{i=1}^n (soll_i - \\bar{soll})^2}{n - 1} = \\frac{", format(sum((object[["data"]][, 3] - mean(object[["data"]][, 3]))^2), nsmall = 2, scientific = F, big.mark=","),"}{", object[["n"]] - 1,"} =", format(stats::var(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=","),"\\\\ s_{soll} &= \\sqrt{s^2_{soll}} = ", format(stats::sd(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=",")," \\\\ t_{", round(object[["confidence"]] + ((1 - object[["confidence"]]) / 2), 3) ,"} \\times \\frac{s_q}{\\sqrt{n}} &= ", round(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1), 3)," \\times \\frac{", format(sqrt(stats::var(object[["data"]][, 3]) - 2 * (mean(object[["data"]][, 3]) / mean(object[["data"]][, 2])) * stats::cor(object[["data"]][, 2], object[["data"]][, 3]) * stats::sd(object[["data"]][, 2]) * stats::sd(object[["data"]][, 3]) + (mean(object[["data"]][, 3]) / mean(object[["data"]][, 2]))^2 * stats::var(object[["data"]][, 2])), nsmall = 2, scientific = F, big.mark=","),"}{\\sqrt{", object[["n"]],"}} = ", format(object[["precision"]]/object[["N"]], nsmall = 2, scientific = F, big.mark=",")," \\end{aligned}$") }` + + +`r if (object[["method"]] == "regression"){ paste0("$\\begin{aligned} \\text{The estimated population misstatemen}&\\text{t } \\hat{E}\\text{ is a generalization of the estimated unit true value }\\hat{\\theta}\\text{:} \\\\ \\\\ \\hat{E} &= B - N \\times \\hat{\\theta} \\\\ &= ", format(object[["popBookvalue"]], scientific = F, big.mark=",")," - ", format(object[["N"]], scientific = F, big.mark=",")," \\times ", format((object[["N"]] * mean(object[["data"]][, 3]) + as.numeric(stats::coef(stats::lm(object[["data"]][, 3] ~ object[["data"]][, 2]))[2]) * (object[["popBookvalue"]] - object[["N"]] * mean(object[["data"]][, 2]))) / object[["N"]], nsmall = 2, scientific = F, big.mark=","),"= ", format(object[["mle"]], nsmall = 2, scientific = F, big.mark=",")," \\\\ \\\\ \\text{The confidence interval for the populat}&\\text{ion misstatement } [E_{",round(1 - (object[["confidence"]] + ((1 - object[["confidence"]])/2)), 3),"}; E_{",round(object[["confidence"]] + ((1 - object[["confidence"]])/2), 3),"}] \\text{ is a generalization of the unit upper and lower bounds:} \\\\ \\\\ [E_{",round(1 - (object[["confidence"]] + ((1 - object[["confidence"]])/2)), 3),"}; E_{",round(object[["confidence"]] + ((1 - object[["confidence"]])/2), 3),"}] &= B - N \\times \\left( \\hat{\\theta} \\pm t_{1 - \\frac{\\alpha}{2}} \\times \\frac{s_r}{\\sqrt{n}} \\right) \\\\ &= ", format(object[["popBookvalue"]], scientific = F, big.mark=",")," - ", format(object[["N"]], scientific = F, big.mark=",")," \\times \\left(",format((object[["N"]] * mean(object[["data"]][, 3]) + as.numeric(stats::coef(stats::lm(object[["data"]][, 3] ~ object[["data"]][, 2]))[2]) * (object[["popBookvalue"]] - object[["N"]] * mean(object[["data"]][, 2]))) / object[["N"]], nsmall = 2, scientific = F, big.mark=",")," \\pm ", format(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1) * ((stats::sd(object[["data"]][, 3]) * sqrt(1 - stats::cor(object[["data"]][, 2], object[["data"]][, 3])^2))/sqrt(object[["n"]])), nsmall = 2, scientific = F, big.mark=",")," \\right) = [", format(object[["lowerBound"]], nsmall = 2, scientific = F, big.mark=","),";", format(object[["upperBound"]], nsmall = 2, scientific = F, big.mark=","),"] \\\\ \\\\ \\text{The other relevant quantities can be de}&\\text{rived using the following formulas:} \\\\ \\\\ \\hat{\\theta} &= \\frac{N \\times \\bar{soll} + \\beta_{1_{soll \\sim ist}} \\times (B - N \\times \\bar{ist})}{N} \\\\ &= \\frac{", format(object[["N"]], scientific = F, big.mark=","), " \\times ", format(mean(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=",")," + ", format(as.numeric(stats::coef(stats::lm(object[["data"]][, 3] ~ object[["data"]][, 2]))[2]), nsmall = 2, scientific = F, big.mark=",")," \\times (", format(object[["popBookvalue"]], scientific = F, big.mark=","), " - ", format(object[["N"]], scientific = F, big.mark=",")," \\times ", format(mean(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=","),")}{", format(object[["N"]], scientific = F, big.mark=","),"} = ",format((object[["N"]] * mean(object[["data"]][, 3]) + as.numeric(stats::coef(stats::lm(object[["data"]][, 3] ~ object[["data"]][, 2]))[2]) * (object[["popBookvalue"]] - object[["N"]] * mean(object[["data"]][, 2]))) / object[["N"]], nsmall = 2, scientific = F, big.mark=",")," \\\\ \\beta_{1_{soll \\sim ist}} &= ", format(as.numeric(stats::coef(stats::lm(object[["data"]][, 3] ~ object[["data"]][, 2]))[2]), nsmall = 2, scientific = F, big.mark=",")," \\\\ \\bar{ist} &= \\frac{\\sum_{i=1}^n ist_i}{n} = \\frac{", format(sum(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=","),"}{", object[["n"]] ,"} = ", format(mean(object[["data"]][, 2]), nsmall = 2, scientific = F, big.mark=","), "\\\\ \\bar{soll} &= \\frac{\\sum_{i=1}^n soll_i}{n} = \\frac{", format(sum(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=","),"}{", object[["n"]] ,"} = ", format(mean(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=","), "\\\\ t_{1 - \\frac{\\alpha}{2}} &= t_{", round(object[["confidence"]] + ((1 - object[["confidence"]]) / 2), 3) ,"} = ", round(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1), 3),"\\\\ s_r &= s_{soll} \\times \\sqrt{1 - r^2_{soll \\sim ist}} = ", format(stats::sd(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=",")," \\times \\sqrt{1 - ", format(stats::cor(object[["data"]][, 2], object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=","),"^2} = ", format(stats::sd(object[["data"]][, 3]) * sqrt(1 - stats::cor(object[["data"]][, 2], object[["data"]][, 3])^2), nsmall = 2, scientific = F, big.mark=","),"\\\\ s_{soll} &= \\sqrt{\\frac{\\sum_{i=1}^n (soll_i - \\bar{soll})^2}{n - 1}} = \\sqrt{\\frac{", format(sum((object[["data"]][, 3] - mean(object[["data"]][, 3]))^2), nsmall = 2, scientific = F, big.mark=",") ,"}{", object[["n"]] - 1,"}} =", format(stats::sd(object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=","),"\\\\ r_{soll \\sim ist} &= Cor(ist, soll) = ", format(stats::cor(object[["data"]][, 2], object[["data"]][, 3]), nsmall = 2, scientific = F, big.mark=",")," \\\\ t_{", round(object[["confidence"]] + ((1 - object[["confidence"]]) / 2), 3) ,"} \\times \\frac{s_r}{\\sqrt{n}} &= ", round(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1), 3)," \\times \\frac{", format(stats::sd(object[["data"]][, 3]) * sqrt(1 - stats::cor(object[["data"]][, 2], object[["data"]][, 3])^2), nsmall = 2, scientific = F, big.mark=","),"}{\\sqrt{", object[["n"]],"}} = ", format(stats::qt(p = object[["confidence"]] + ((1 - object[["confidence"]]) / 2), df = object[["n"]] - 1) * ((stats::sd(object[["data"]][, 3]) * sqrt(1 - stats::cor(object[["data"]][, 2], object[["data"]][, 3])^2))/sqrt(object[["n"]])), nsmall = 2, scientific = F, big.mark=",")," \\end{aligned}$") }` + + +`r if (object[["method"]] == "binomial" & is.null(object[["prior"]])){ paste0("$\\begin{aligned} \\text{The estimated population misstatemen}&\\text{t } \\hat{E}\\text{ is a generalization of the estimated unit misstatement }\\hat{\\theta}\\text{:} \\\\ \\\\ \\hat{E} &= B \\times \\hat{\\theta} ",if(!is.null(object[["popBookvalue"]])){ paste0("\\\\ &= ", format(object[["popBookvalue"]], scientific = F, big.mark=",")," \\times ", format(object[["mle"]], nsmall = 2, scientific = F, big.mark = ",")," = ",format(object[["popBookvalue"]] * object[["mle"]], nsmall = 2, scientific = F, big.mark=","))} else { }," \\\\ \\\\ \\text{The upper bound for the population mi}&\\text{sstatement } E_{",round(object[["confidence"]], 3),"} \\text{ is a generalization of the unit upper bound } \\theta_{",round(object[["confidence"]], 3),"} \\text{:} \\\\ \\\\ E_{", round(object[["confidence"]], 3),"} &= B \\times \\theta_{", round(object[["confidence"]], 3),"} ",if(!is.null(object[["popBookvalue"]])){ paste0("\\\\ &= ", format(object[["popBookvalue"]], scientific = F, big.mark=",")," \\times ", format(object[["confBound"]], nsmall = 2, scientific = F, big.mark = ",")," = ",format(object[["popBookvalue"]] * object[["confBound"]], nsmall = 2, scientific = F, big.mark=","))} else { }," \\\\ \\\\ \\text{The other relevant quantities can be de}&\\text{rived using the following formulas:} \\\\ \\\\ \\hat{\\theta} &= \\frac{k}{n} = \\frac{", object[["k"]],"}{", object[["n"]],"} = ",format(object[["k"]]/object[["n"]], nsmall = 2, scientific = F, big.mark=",")," \\\\ \\theta_{", round(object[["confidence"]], 3),"} &= \\text{Beta}(1 - \\alpha; 1 + k, n - k) = \\text{Beta}(",round(object[["confidence"]], 3),"; ", object[["k"]] + 1,", ", object[["n"]] - object[["k"]],") = ",format(object[["confBound"]], nsmall = 2, scientific = F, big.mark=",")," \\end{aligned}$") }` + + +`r if (object[["method"]] == "binomial" & !is.null(object[["prior"]])){ paste0("$\\begin{aligned} \\text{The estimated population misstatemen}&\\text{t } \\hat{E}\\text{ is a generalization of the estimated unit misstatement }\\hat{\\theta}\\text{:} \\\\ \\\\ \\hat{E} &= B \\times \\hat{\\theta} ",if(!is.null(object[["popBookvalue"]])){ paste0("\\\\ &= ", format(object[["popBookvalue"]], scientific = F, big.mark=",")," \\times ", format(object[["mle"]], nsmall = 2, scientific = F, big.mark = ",")," = ",format(object[["popBookvalue"]] * object[["mle"]], nsmall = 2, scientific = F, big.mark=","))} else { }," \\\\ \\\\ \\text{The upper bound for the population mi}&\\text{sstatement } E_{",round(object[["confidence"]], 3),"} \\text{ is a generalization of the unit upper bound } \\theta_{",round(object[["confidence"]], 3),"} \\text{:} \\\\ \\\\ E_{", round(object[["confidence"]], 3),"} &= B \\times \\theta_{", round(object[["confidence"]], 3),"} ",if(!is.null(object[["popBookvalue"]])){ paste0("\\\\ &= ", format(object[["popBookvalue"]], scientific = F, big.mark=",")," \\times ", format(object[["confBound"]], nsmall = 2, scientific = F, big.mark = ",")," = ",format(object[["popBookvalue"]] * object[["confBound"]], nsmall = 2, scientific = F, big.mark=","))} else { }," \\\\ \\\\ \\text{The other relevant quantities can be de}&\\text{rived using the following formulas:} \\\\ \\\\ \\alpha_0 &= ", format(object[["prior"]][["description"]]$alpha, nsmall = 2, scientific = F, big.mark = ","),"\\\\ \\beta_0 &= ", format(object[["prior"]][["description"]]$beta, nsmall = 2, scientific = F, big.mark = ",")," \\\\ \\alpha_1 &= \\alpha_0 + t =", format(object[["posterior"]][["description"]]$alpha, nsmall = 2, scientific = F, big.mark = ","),"\\\\ \\beta_1 &= \\beta_0 + n - t =", format(object[["posterior"]][["description"]]$beta, nsmall = 2, scientific = F, big.mark = ",")," \\\\ \\hat{\\theta} &= \\frac{\\alpha_1 - 1}{\\alpha_1 + \\beta_1 - 2} = \\frac{", format(object[["posterior"]][["description"]]$alpha, nsmall = 2, scientific = F, big.mark = ",")," - 1}{", format(object[["posterior"]][["description"]]$alpha, nsmall = 2, scientific = F, big.mark = ","), "+ ", format(object[["posterior"]][["description"]]$beta, nsmall = 2, scientific = F, big.mark = ",")," - 2} = ",format(object[["mle"]], nsmall = 2, scientific = F, big.mark = ",")," \\\\ \\theta_{", round(object[["confidence"]], 3),"} &= \\text{Beta}(1 - \\alpha; \\alpha_0 + t, \\beta_0 + n - t) = \\text{Beta}(",round(object[["confidence"]], 3),"; ", format(object[["posterior"]][["description"]]$alpha, nsmall = 2, scientific = F, big.mark = ","),", ", format(object[["posterior"]][["description"]]$beta, nsmall = 2, scientific = F, big.mark = ","),") = ", format(object[["confBound"]], nsmall = 2, scientific = F, big.mark = ",")," \\\\ t &= \\sum_{i=1}^n \\frac{ist_i - soll_i}{ist_i} = ", format(object[["t"]], nsmall = 2, scientific = F, big.mark = ",")," \\end{aligned}$") }` + + +`r if (object[["method"]] == "stringer"){ paste0("$\\begin{aligned} \\text{The estimated population misstatemen}&\\text{t } \\hat{E}\\text{ is a generalization of the estimated unit misstatement }\\hat{\\theta}\\text{:} \\\\ \\\\ \\hat{E} &= B \\times \\hat{\\theta} ",if(!is.null(object[["popBookvalue"]])){ paste0("\\\\ &= ", format(object[["popBookvalue"]], scientific = F, big.mark=",")," \\times ", format(object[["mle"]], nsmall = 2, scientific = F, big.mark = ",")," = ",format(object[["popBookvalue"]] * object[["mle"]], nsmall = 2, scientific = F, big.mark=","))} else { }," \\\\ \\\\ \\text{The upper bound for the population mi}&\\text{sstatement } E_{",round(object[["confidence"]], 3),"} \\text{ is a generalization of the unit upper bound } \\theta_{",round(object[["confidence"]], 3),"} \\text{:} \\\\ \\\\ E_{", round(object[["confidence"]], 3),"} &= B \\times \\theta_{", round(object[["confidence"]], 3),"} ",if(!is.null(object[["popBookvalue"]])){ paste0("\\\\ &= ", format(object[["popBookvalue"]], scientific = F, big.mark=",")," \\times ", format(object[["confBound"]], nsmall = 2, scientific = F, big.mark = ",")," = ",format(object[["popBookvalue"]] * object[["confBound"]], nsmall = 2, scientific = F, big.mark=","))} else { }," \\\\ \\\\ \\text{The other relevant quantities can be de}&\\text{rived using the following formulas:} \\\\ \\\\ \\hat{\\theta} &= \\frac{t}{n} = \\frac{", format(object[["t"]], nsmall = 2, scientific = F, big.mark = ","),"}{", object[["n"]],"} = ",format(object[["t"]]/object[["n"]], nsmall = 2, scientific = F, big.mark = ",")," \\\\ \\theta_{", round(object[["confidence"]], 3),"} &= \\text{Beta}(1 - \\alpha; 1 + t, n - t) = \\text{Beta}(",round(object[["confidence"]], 3),"; ", format(object[["t"]] + 1, nsmall = 2, scientific = F, big.mark = ","),", ", format(object[["n"]] - object[["t"]], nsmall = 2, scientific = F, big.mark = ","),") = ",format(object[["confBound"]], nsmall = 2, scientific = F, big.mark = ",")," \\\\ t &= \\sum_{i=1}^n \\frac{ist_i - soll_i}{ist_i} = ", format(object[["t"]], nsmall = 2, scientific = F, big.mark = ","),"\\end{aligned}$") }` + +*Evaluation:* + + +`r if(object[["method"]] %in% c("difference", "direct", "quotient", "regression") & object[["materiality"]] != 1){ paste0(ifelse(object[["upperBound"]] < (object[["materiality"]] * object[["popBookvalue"]]), yes = "✔️", no = "❌"), "$\\hspace{0.5cm} \\text{Upper bound lower than performance materiality} \\rightarrow E_{",round(object[["confidence"]] + ((1 - object[["confidence"]])/2), 3),"} < E_{max} \\rightarrow ", format(object[["upperBound"]], nsmall = 2, scientific = F, big.mark=","),"<", format(object[["materiality"]] * object[["popBookvalue"]], digits = 3, scientific = F, big.mark = ","), "$") }` + + +`r if(!(object[["method"]] %in% c("difference", "direct", "quotient", "regression")) & object[["materiality"]] != 1){ paste0(ifelse(object[["confBound"]] < object[["materiality"]], yes = "✔️", no = "❌"), "$\\hspace{0.5cm} \\text{Upper bound lower than performance materiality} \\rightarrow \\theta_{", round(object[["confidence"]], 3),"} < \\theta_{max} \\rightarrow ", format(object[["confBound"]], nsmall = 2, scientific = F, big.mark = ","),"<", format(object[["materiality"]], nsmall = 2, scientific = F, big.mark = ","), "$") }` + + +`r if(object[["method"]] %in% c("difference", "direct", "quotient", "regression") & object[["minPrecision"]] != 1){ paste0(ifelse(object[["precision"]] < (object[["minPrecision"]] * object[["popBookvalue"]]), yes = "✔️", no = "❌"), "$\\hspace{0.5cm} \\text{Precision is at least the minimum required precision} \\rightarrow E_{",round(object[["confidence"]] + ((1 - object[["confidence"]])/2), 3),"} - \\hat{E} < \\theta_{",round(object[["confidence"]] + ((1 - object[["confidence"]])/2), 3),"} - \\hat{\\theta} \\rightarrow ", format(object[["precision"]], nsmall = 2, scientific = F, big.mark=","),"<", format(object[["minPrecision"]] * object[["popBookvalue"]], digits = 3, scientific = F, big.mark=","), "$") }` + + +`r if(!(object[["method"]] %in% c("difference", "direct", "quotient", "regression")) & object[["minPrecision"]] != 1){ paste0(ifelse(object[["precision"]] < object[["minPrecision"]], yes = "✔️", no = "❌"), "$\\hspace{0.5cm} \\text{Precision is at least the minimum required precision} \\rightarrow \\theta_{", round(object[["confidence"]], 3),"} - \\hat{\\theta} < \\theta_{", round(object[["confidence"]], 3),"} - \\hat{\\theta} \\rightarrow ", format(object[["precision"]], nsmall = 2, scientific = F, big.mark = ","),"<", format(object[["minPrecision"]], nsmall = 2, scientific = F, big.mark = ","), "$") }` + +*References:* + + +`r if (object[["method"]] %in% c("direct", "difference", "quotient", "regression")){ "* Touw, P. & Hoogduin, L. (2011). *Statistiek voor audit en controlling*. Boom uitgevers, Amsterdam." }` + +`r if (object[["method"]] %in% c("stringer")){ "* Bickel, P. J. (1992). Inference and auditing: The Stringer bound. *International Statistical Review*, 60(2), 197–209." }` + +`r if (object[["method"]] %in% c("binomial") & is.null(object[["prior"]])){ "* Stewart, T. R. (2012). *Technical notes on the AICPA audit guide audit sampling*. American Institute of Certified Public Accountants, New York." }` + +`r if (object[["method"]] %in% c("binomial") & !is.null(object[["prior"]])){ "* Steele, A. (1992). *Audit risk and audit evidence: The Bayesian approach to statistical auditing*. San Diego: Academic Press.\n* Stewart, T. R. (2013). *A Bayesian audit assurance model with application to the component materiality problem in group audits*. VU University, Amsterdam." }` + + +`r if (!is.null(object[["data"]])){ "\\newpage" }` +`r if (!is.null(object[["data"]])){ "### Appendix B: Data" }` +`r if (!is.null(object[["data"]])){ "\n---" }` + +```{r, echo = FALSE} +if(!is.null(object[["data"]])){ + tab <- knitr::kable(object[["data"]], + digits = 3, + caption = "Table 3: Relevant data obtained from the input sample.", + align = "c", + format = "html", + row.names = FALSE, + format.args = list(big.mark = ",", scientific = FALSE), + table.attr = "style='width:70%;'") + kableExtra::kable_classic(tab, position="center", html_font = "Cambria") +} else { + +} +``` + diff --git a/man/evaluation.Rd b/man/evaluation.Rd index fa9573695..91c4a360c 100644 --- a/man/evaluation.Rd +++ b/man/evaluation.Rd @@ -75,6 +75,7 @@ An object of class \code{jfaEvaluation} containing: \item{populationK}{the assumed total errors in the population. Used in inferences with \code{hypergeometric} method.} \item{prior}{an object of class 'jfaPrior' to represents the prior distribution.} \item{posterior}{an object of class 'jfaPosterior' to represents the posterior distribution.} +\item{data}{a data frame containing the relevant columns from the \code{sample} input.} } \description{ This function takes a data frame (using \code{sample}, \code{bookValue}, and \code{auditValues}) or summary statistics (using \code{nSumstats} and \code{kSumstats}) and evaluates the audit sample according to the specified method. The returned object is of class \code{jfaEvaluation} and can be used with associated \code{print()} and \code{plot()} methods. diff --git a/man/figures/readme/banner/jfaBanner.png b/man/figures/readme/banner/jfaBanner.png index 7513dd676..42285e856 100644 Binary files a/man/figures/readme/banner/jfaBanner.png and b/man/figures/readme/banner/jfaBanner.png differ diff --git a/man/figures/readme/banner/jfaBanner.svg b/man/figures/readme/banner/jfaBanner.svg index 5e70b9dc4..4f9ca5f40 100644 --- a/man/figures/readme/banner/jfaBanner.svg +++ b/man/figures/readme/banner/jfaBanner.svg @@ -21,7 +21,7 @@ xml:space="preserve" sodipodi:docname="jfaBanner.svg" inkscape:version="0.92.3 (2405546, 2018-03-11)" - inkscape:export-filename="C:\Users\derksk\OneDrive - NBU\Desktop\jfa\man\figures\banner\jfaBanner.png" + inkscape:export-filename="C:\Users\derksk\OneDrive - NBU\Desktop\jfa\man\figures\readme\banner\jfaBanner.png" inkscape:export-xdpi="116.90842" inkscape:export-ydpi="116.90842"> @@ -91,7 +91,13 @@ id="Page-1">jfa's workflow: + planning() + selection() + evaluation() + + inspection + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:13.40705585px;font-family:'Courier New';-inkscape-font-specification:'Courier New Bold';stroke-width:1.00552917">report() + auditPrior() + \ No newline at end of file diff --git a/man/figures/readme/downloads/downloads.svg b/man/figures/readme/downloads/downloads.svg index aeeb9b040..67ec41d34 100644 --- a/man/figures/readme/downloads/downloads.svg +++ b/man/figures/readme/downloads/downloads.svg @@ -62,7 +62,7 @@ - + 324 250 267 @@ -73,7 +73,7 @@ 695 770 670 -445 +563 diff --git a/man/figures/readme/report/report.html b/man/figures/readme/report/report.html new file mode 100644 index 000000000..009b8108c --- /dev/null +++ b/man/figures/readme/report/report.html @@ -0,0 +1,3056 @@ + + + + + + + + + + + + + +Audit sampling report + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+

logo

+

This report was created by R version 3.6.3 (2020-02-29) and its package jfa (version 0.5.0)1. jfa provides Bayesian and classical audit sampling analyses and is available on CRAN.

+

jfa is free software and you can redistribute it and or modify it under the terms of the GNU GPL-3 as published by the Free Software Foundation. The package is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability of fitness for a particular purpose.

+

Visit the package website to learn more!

+
+

Summary

+
+ +

The objective of this sampling procedure is to determine with a confidence of 95% whether the percentage of misstatement in the population is lower than the performance materiality of 17.425% ( = $2,000,000)

+ + + + + + + + + + + + + + + + + + + + + +
+Table 1: Summary of the sampling results. +
+Sample size + +Deviations + +Total taint +
+130 + +6 + +NaN +
+a The total taint could not be calculated because
some ist values are zero. +
+
+


+
+

The table below summarizes the estimated misstatement in the population, including the most likely error, the 95% upper bound, and the obtained precision. As a justification of these results, appendix A contains the derivations upon which they are based. Appendix B lists the input data.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Table 2: Summary of the inferential results. +
+ +Most likely error + +Lower bound + +Upper bound + +Precision +
+x 100 = % + +0.000 + +-0.012 + +0.012 + +0.012 +
+$ + +-1,383.038 + +-142,457.836 + +139,691.760 + +141,074.798 +
+a The top row shows the misstatement as a fraction of the total value. +
+

+
+
+
+

Appendix A: Derivations

+
+

These results have been calculated using the difference estimator (Touw & Hoogduin, 2011). The units of inference are individual transactions.

+

Notation:

+ + +

\[\begin{equation}\begin{split}\text{Ist position: }& ist = \text{ist_euro} \\ \text{Soll position: }& soll = \text{soll_euro} \\ \text{Sample size: }& n = 130 \\ \text{Population size: }& N = 50,152\\ \text{Population value: }& B = 11,477,820 \\ \text{Sampling risk: }& \alpha = 0.05\end{split} \hspace{4cm} \begin{split} \text{Estimated population misstatement: }& \hat{E} \\ \text{Lower bound population misstatement: }& E_{0.025} \\ \text{Upper bound population misstatement: }& E_{0.975} \\ \text{Estimated unit misstatement: }& \hat{\theta} \end{split}\end{equation}\]

+ +

Calculation:

+ + +

\(\begin{aligned} \text{The estimated population misstatemen}&\text{t } \hat{E}\text{ is a generalization of the estimated unit misstatement }\hat{\theta}\text{:} \\ \\ \hat{E} &= N \times \hat{\theta} \\ &= 50,152 \times -0.02757692 = -1,383.038 \\ \\ \text{The confidence interval for the populat}&\text{ion misstatement } [E_{0.025}; E_{0.975}] \text{ is a generalization of the unit upper and lower bounds:} \\ \\ [E_{0.025}; E_{0.975}] &= N \times \left( \hat{\theta} \pm t_{1 - \frac{\alpha}{2}} \times \frac{s_e}{\sqrt{n}} \right) \\ &= 50,152 \times \left(-0.02757692 \pm 2.812945\right) = [-142,457.84;139,691.76 ] \\ \\ \text{The other relevant quantities can be de}&\text{rived using the following formulas:} \\ \\ \hat{\theta} &= \frac{\sum_{i=1}^n ist_i - soll_i}{n} = \frac{-3.585}{130} = -0.02757692\\ t_{1 - \frac{\alpha}{2}} &= t_{0.975} = 1.979\\ s_e &= \sqrt{\frac{\sum_{i=1}^n ([ist_i - soll_i] - \hat{\theta})^2}{n - 1}} = \sqrt{\frac{33,897.88}{129}} =16.21031\\ t_{0.975} \times \frac{s_e}{\sqrt{n}} &= 1.979 \times \frac{16.21031}{\sqrt{130}} = 2.812945\end{aligned}\)

+ + + + + +

Evaluation:

+ +

✔️\(\hspace{0.5cm} \text{Upper bound lower than performance materiality} \rightarrow E_{0.975} < E_{max} \rightarrow 139,691.76<2,000,000\)

+ + + +

References:

+ +
    +
  • Touw, P. & Hoogduin, L. (2011). Statistiek voor audit en controlling. Boom uitgevers, Amsterdam.
  • +
+ +
+
+
+

Appendix B: Data

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Table 3: Relevant data obtained from the input sample. +
+Row + +ist_euro + +soll_euro + +Difference + +Taint +
+96 + +0.000 + +91.546 + +-91.546 + +-Inf +
+97 + +63.770 + +63.770 + +0.000 + +0.000 +
+98 + +0.000 + +0.000 + +0.000 + +NaN +
+99 + +1,451.754 + +1,451.754 + +0.000 + +0.000 +
+100 + +106.608 + +106.608 + +0.000 + +0.000 +
+101 + +162.621 + +162.621 + +0.000 + +0.000 +
+102 + +1,795.500 + +1,795.500 + +0.000 + +0.000 +
+103 + +129.715 + +129.715 + +0.000 + +0.000 +
+104 + +138.892 + +0.000 + +138.892 + +1.000 +
+105 + +78.000 + +78.000 + +0.000 + +0.000 +
+106 + +102.451 + +102.451 + +0.000 + +0.000 +
+107 + +36.457 + +36.457 + +0.000 + +0.000 +
+108 + +139.936 + +139.936 + +0.000 + +0.000 +
+109 + +22.000 + +22.000 + +0.000 + +0.000 +
+110 + +0.000 + +0.000 + +0.000 + +NaN +
+111 + +1,807.029 + +1,807.029 + +0.000 + +0.000 +
+112 + +0.000 + +0.000 + +0.000 + +NaN +
+113 + +433.680 + +433.680 + +0.000 + +0.000 +
+114 + +0.000 + +0.000 + +0.000 + +NaN +
+115 + +0.000 + +0.000 + +0.000 + +NaN +
+116 + +0.000 + +0.000 + +0.000 + +NaN +
+117 + +0.000 + +0.000 + +0.000 + +NaN +
+118 + +34.603 + +34.603 + +0.000 + +0.000 +
+119 + +37.800 + +37.800 + +0.000 + +0.000 +
+120 + +28.256 + +28.256 + +0.000 + +0.000 +
+121 + +35.568 + +35.568 + +0.000 + +0.000 +
+122 + +72.146 + +72.146 + +0.000 + +0.000 +
+123 + +11.684 + +11.684 + +0.000 + +0.000 +
+124 + +0.000 + +0.000 + +0.000 + +NaN +
+125 + +50.494 + +50.494 + +0.000 + +0.000 +
+126 + +54.032 + +54.032 + +0.000 + +0.000 +
+127 + +114.840 + +114.840 + +0.000 + +0.000 +
+128 + +12.937 + +12.937 + +0.000 + +0.000 +
+129 + +36.994 + +36.994 + +0.000 + +0.000 +
+130 + +43.738 + +43.738 + +0.000 + +0.000 +
+131 + +49.603 + +49.603 + +0.000 + +0.000 +
+132 + +765.191 + +765.191 + +0.000 + +0.000 +
+133 + +68.560 + +68.560 + +0.000 + +0.000 +
+134 + +71.040 + +71.040 + +0.000 + +0.000 +
+135 + +36.648 + +36.648 + +0.000 + +0.000 +
+136 + +17.201 + +22.934 + +-5.734 + +-0.333 +
+137 + +40.219 + +40.219 + +0.000 + +0.000 +
+138 + +72.944 + +72.944 + +0.000 + +0.000 +
+139 + +1,060.050 + +1,060.050 + +0.000 + +0.000 +
+140 + +44.160 + +44.160 + +0.000 + +0.000 +
+141 + +0.000 + +0.000 + +0.000 + +NaN +
+142 + +28.026 + +28.026 + +0.000 + +0.000 +
+143 + +420.350 + +420.350 + +0.000 + +0.000 +
+144 + +304.560 + +304.560 + +0.000 + +0.000 +
+145 + +0.000 + +72.248 + +-72.248 + +-Inf +
+146 + +20.176 + +20.176 + +0.000 + +0.000 +
+147 + +54.828 + +54.828 + +0.000 + +0.000 +
+148 + +50.286 + +50.286 + +0.000 + +0.000 +
+149 + +343.992 + +347.901 + +-3.909 + +-0.011 +
+150 + +76.045 + +76.045 + +0.000 + +0.000 +
+151 + +30.745 + +30.745 + +0.000 + +0.000 +
+152 + +51.177 + +51.177 + +0.000 + +0.000 +
+153 + +157.489 + +157.489 + +0.000 + +0.000 +
+154 + +46.211 + +46.211 + +0.000 + +0.000 +
+155 + +502.632 + +502.632 + +0.000 + +0.000 +
+156 + +195.200 + +195.200 + +0.000 + +0.000 +
+157 + +55.958 + +55.958 + +0.000 + +0.000 +
+158 + +146.364 + +146.364 + +0.000 + +0.000 +
+159 + +84.806 + +84.806 + +0.000 + +0.000 +
+160 + +226.044 + +226.044 + +0.000 + +0.000 +
+161 + +115.306 + +115.306 + +0.000 + +0.000 +
+162 + +268.320 + +237.360 + +30.960 + +0.115 +
+163 + +55.094 + +55.094 + +0.000 + +0.000 +
+164 + +17.080 + +17.080 + +0.000 + +0.000 +
+165 + +0.000 + +0.000 + +0.000 + +NaN +
+166 + +68.560 + +68.560 + +0.000 + +0.000 +
+167 + +2,059.260 + +2,059.260 + +0.000 + +0.000 +
+168 + +64.500 + +64.500 + +0.000 + +0.000 +
+169 + +84.395 + +84.395 + +0.000 + +0.000 +
+170 + +17.286 + +17.286 + +0.000 + +0.000 +
+171 + +85.160 + +85.160 + +0.000 + +0.000 +
+172 + +21.600 + +21.600 + +0.000 + +0.000 +
+173 + +13.032 + +13.032 + +0.000 + +0.000 +
+174 + +31.500 + +31.500 + +0.000 + +0.000 +
+175 + +40.952 + +40.952 + +0.000 + +0.000 +
+176 + +47.760 + +47.760 + +0.000 + +0.000 +
+177 + +38.271 + +38.271 + +0.000 + +0.000 +
+178 + +17.219 + +17.219 + +0.000 + +0.000 +
+179 + +51.480 + +51.480 + +0.000 + +0.000 +
+180 + +221.707 + +221.707 + +0.000 + +0.000 +
+181 + +491.882 + +491.882 + +0.000 + +0.000 +
+182 + +32.191 + +32.191 + +0.000 + +0.000 +
+183 + +59.944 + +59.944 + +0.000 + +0.000 +
+184 + +49.024 + +49.024 + +0.000 + +0.000 +
+185 + +37.357 + +37.357 + +0.000 + +0.000 +
+186 + +730.850 + +730.850 + +0.000 + +0.000 +
+187 + +95.856 + +95.856 + +0.000 + +0.000 +
+188 + +1,178.573 + +1,178.573 + +0.000 + +0.000 +
+189 + +39.040 + +39.040 + +0.000 + +0.000 +
+190 + +34.596 + +34.596 + +0.000 + +0.000 +
+191 + +38.550 + +38.550 + +0.000 + +0.000 +
+192 + +26.046 + +26.046 + +0.000 + +0.000 +
+193 + +2,418.150 + +2,418.150 + +0.000 + +0.000 +
+194 + +519.360 + +519.360 + +0.000 + +0.000 +
+195 + +0.000 + +0.000 + +0.000 + +NaN +
+196 + +23.680 + +23.680 + +0.000 + +0.000 +
+197 + +53.060 + +53.060 + +0.000 + +0.000 +
+198 + +19.667 + +19.667 + +0.000 + +0.000 +
+199 + +51.341 + +51.341 + +0.000 + +0.000 +
+200 + +0.000 + +0.000 + +0.000 + +NaN +
+201 + +28.346 + +28.346 + +0.000 + +0.000 +
+202 + +0.000 + +0.000 + +0.000 + +NaN +
+203 + +22.374 + +22.374 + +0.000 + +0.000 +
+204 + +3.494 + +3.494 + +0.000 + +0.000 +
+205 + +31.120 + +31.120 + +0.000 + +0.000 +
+206 + +72.674 + +72.674 + +0.000 + +0.000 +
+207 + +13.183 + +13.183 + +0.000 + +0.000 +
+208 + +17.862 + +17.862 + +0.000 + +0.000 +
+209 + +70.442 + +70.442 + +0.000 + +0.000 +
+210 + +52.104 + +52.104 + +0.000 + +0.000 +
+211 + +10.104 + +10.104 + +0.000 + +0.000 +
+212 + +25.027 + +25.027 + +0.000 + +0.000 +
+213 + +224.100 + +224.100 + +0.000 + +0.000 +
+214 + +43.738 + +43.738 + +0.000 + +0.000 +
+215 + +812.818 + +812.818 + +0.000 + +0.000 +
+216 + +170.395 + +170.395 + +0.000 + +0.000 +
+217 + +75.900 + +75.900 + +0.000 + +0.000 +
+218 + +72.240 + +72.240 + +0.000 + +0.000 +
+219 + +18.609 + +18.609 + +0.000 + +0.000 +
+220 + +35.830 + +35.830 + +0.000 + +0.000 +
+221 + +1,066.464 + +1,066.464 + +0.000 + +0.000 +
+222 + +758.880 + +758.880 + +0.000 + +0.000 +
+223 + +795.648 + +795.648 + +0.000 + +0.000 +
+224 + +37.440 + +37.440 + +0.000 + +0.000 +
+225 + +39.200 + +39.200 + +0.000 + +0.000 +
+
+
+
+
    +
  1. jfa’s source code can be found on its GitHub page↩︎

  2. +
+
+ + + + +
+ + + + + + + + + + + + + + + diff --git a/man/figures/readme/report/report.pdf b/man/figures/readme/report/report.pdf new file mode 100644 index 000000000..08faeee3d Binary files /dev/null and b/man/figures/readme/report/report.pdf differ diff --git a/man/figures/readme/worldmap/downloads.csv b/man/figures/readme/worldmap/downloads.csv index 529c4658a..23f983f6a 100644 --- a/man/figures/readme/worldmap/downloads.csv +++ b/man/figures/readme/worldmap/downloads.csv @@ -5108,3 +5108,132 @@ "2020-11-16","08:27:18",212829,NA,NA,NA,"jfa","0.4.0","US",8682 "2020-11-16","16:24:15",2825719,NA,NA,NA,"jfa","0.4.0","GB",18441 "2020-11-16","20:49:49",2825719,NA,NA,NA,"jfa","0.4.0","PL",37919 +"2020-11-17","22:01:38",2524423,NA,NA,NA,"jfa","0.3.0",NA,7 +"2020-11-17","22:01:40",2704899,NA,NA,NA,"jfa","0.3.1",NA,7 +"2020-11-17","23:23:02",211707,"4.0.2","i386","mingw32","jfa","0.4.0","US",7070 +"2020-11-17","21:26:06",211716,"3.4.1","x86_64","linux-gnu","jfa","0.4.0","DE",31642 +"2020-11-17","04:08:55",211707,NA,NA,NA,"jfa","0.4.0","JP",30186 +"2020-11-17","09:09:38",189430,NA,NA,NA,"jfa","0.1.0","US",11156 +"2020-11-17","09:09:38",528,NA,NA,NA,"jfa","0.1.0","US",11156 +"2020-11-17","09:09:38",189431,NA,NA,NA,"jfa","0.1.0","US",11156 +"2020-11-17","20:51:22",211707,"3.4.1","x86_64","linux-gnu","jfa","0.4.0","ES",21874 +"2020-11-17","09:58:54",210078,NA,NA,NA,"jfa","0.4.0","US",11156 +"2020-11-17","09:58:54",531,NA,NA,NA,"jfa","0.4.0","US",11156 +"2020-11-17","09:58:54",210079,NA,NA,NA,"jfa","0.4.0","US",11156 +"2020-11-17","13:58:49",211712,"3.5.1","x86_64","mingw32","jfa","0.4.0","JO",13943 +"2020-11-17","08:21:21",212829,NA,NA,NA,"jfa","0.4.0","US",11156 +"2020-11-17","08:21:21",212836,NA,NA,NA,"jfa","0.4.0","US",11156 +"2020-11-17","08:21:20",534,NA,NA,NA,"jfa","0.4.0","US",11156 +"2020-11-17","12:02:22",210808,NA,NA,NA,"jfa","0.4.0","US",4494 +"2020-11-17","12:02:22",531,NA,NA,NA,"jfa","0.4.0","US",4494 +"2020-11-17","12:02:22",210809,NA,NA,NA,"jfa","0.4.0","US",4494 +"2020-11-17","08:13:30",620909,NA,NA,NA,"jfa","0.4.0","US",43777 +"2020-11-17","08:12:46",210179,NA,NA,NA,"jfa","0.4.0","US",8120 +"2020-11-17","08:13:13",14524,NA,NA,NA,"jfa","0.4.0","US",684 +"2020-11-17","13:36:29",211716,"4.0.3","x86_64","mingw32","jfa","0.4.0","JO",13943 +"2020-11-17","14:21:53",211707,NA,NA,NA,"jfa","0.4.0","US",2820 +"2020-11-17","22:01:33",1675177,NA,NA,NA,"jfa","0.1.0",NA,7 +"2020-11-17","22:01:36",2348359,NA,NA,NA,"jfa","0.2.0",NA,7 +"2020-11-17","21:11:38",211706,"3.4.1","x86_64","linux-gnu","jfa","0.4.0","DE",51767 +"2020-11-17","23:30:53",2825719,NA,NA,NA,"jfa","0.4.0","HK",7075 +"2020-11-17","13:12:41",211706,"3.5.3","x86_64","mingw32","jfa","0.4.0","JO",13943 +"2020-11-17","13:14:37",211707,NA,NA,NA,"jfa","0.4.0","ZA",187 +"2020-11-18","12:07:13",210085,NA,NA,NA,"jfa","0.4.0","US",5 +"2020-11-18","12:07:13",537,NA,NA,NA,"jfa","0.4.0","US",5 +"2020-11-18","12:07:13",210078,NA,NA,NA,"jfa","0.4.0","US",5 +"2020-11-18","16:10:56",211707,NA,NA,NA,"jfa","0.4.0","PY",6156 +"2020-11-18","20:35:48",533,NA,NA,NA,"jfa","0.1.0","US",3362 +"2020-11-18","20:35:48",533,NA,NA,NA,"jfa","0.2.0","US",3362 +"2020-11-18","20:35:48",533,NA,NA,NA,"jfa","0.3.0","US",3362 +"2020-11-18","20:35:48",533,NA,NA,NA,"jfa","0.3.1","US",3362 +"2020-11-18","17:52:49",211707,"3.4.4","x86_64","linux-gnu","jfa","0.4.0",NA,6 +"2020-11-18","19:55:34",211707,"3.5.2","x86_64","linux-gnu","jfa","0.4.0",NA,6 +"2020-11-18","11:34:30",210816,NA,NA,NA,"jfa","0.4.0","US",927 +"2020-11-18","11:34:25",210809,NA,NA,NA,"jfa","0.4.0","US",927 +"2020-11-18","19:25:28",533,NA,NA,NA,"jfa","0.4.0","US",3362 +"2020-11-18","08:15:53",212829,NA,NA,NA,"jfa","0.4.0","US",35179 +"2020-11-18","08:15:53",212830,NA,NA,NA,"jfa","0.4.0","US",35179 +"2020-11-18","08:15:53",528,NA,NA,NA,"jfa","0.4.0","US",35179 +"2020-11-18","09:38:44",537,NA,NA,NA,"jfa","0.4.0","US",35179 +"2020-11-18","09:38:44",210808,NA,NA,NA,"jfa","0.4.0","US",35179 +"2020-11-18","09:38:44",210815,NA,NA,NA,"jfa","0.4.0","US",35179 +"2020-11-18","02:19:33",2825719,NA,NA,NA,"jfa","0.4.0","KR",4281 +"2020-11-18","09:03:21",189437,NA,NA,NA,"jfa","0.1.0","US",35179 +"2020-11-18","09:03:21",534,NA,NA,NA,"jfa","0.1.0","US",35179 +"2020-11-18","09:03:21",189430,NA,NA,NA,"jfa","0.1.0","US",35179 +"2020-11-18","06:10:41",210079,NA,NA,NA,"jfa","0.4.0","US",3465 +"2020-11-18","20:08:50",533,NA,NA,NA,"jfa","0.1.0","US",3362 +"2020-11-18","20:08:50",533,NA,NA,NA,"jfa","0.2.0","US",3362 +"2020-11-18","20:08:50",533,NA,NA,NA,"jfa","0.3.0","US",3362 +"2020-11-18","20:08:50",533,NA,NA,NA,"jfa","0.3.1","US",3362 +"2020-11-18","09:34:36",2825725,"3.5.2","x86_64","linux-gnu","jfa","0.4.0","KR",35188 +"2020-11-19","09:22:42",211706,NA,NA,NA,"jfa","0.4.0","KR",7636 +"2020-11-19","09:22:42",211707,NA,NA,NA,"jfa","0.4.0","KR",7636 +"2020-11-19","12:47:00",210815,NA,NA,NA,"jfa","0.4.0","US",596 +"2020-11-19","10:49:14",210078,NA,NA,NA,"jfa","0.4.0","US",1560 +"2020-11-19","10:49:14",531,NA,NA,NA,"jfa","0.4.0","US",1560 +"2020-11-19","10:49:14",210079,NA,NA,NA,"jfa","0.4.0","US",1560 +"2020-11-19","16:11:41",2825719,NA,NA,NA,"jfa","0.4.0","US",11361 +"2020-11-19","09:30:39",189430,NA,NA,NA,"jfa","0.1.0","US",7591 +"2020-11-19","09:30:39",528,NA,NA,NA,"jfa","0.1.0","US",7591 +"2020-11-19","09:30:39",189431,NA,NA,NA,"jfa","0.1.0","US",7591 +"2020-11-19","11:02:21",210808,NA,NA,NA,"jfa","0.4.0","US",1560 +"2020-11-19","11:02:21",210809,NA,NA,NA,"jfa","0.4.0","US",1560 +"2020-11-19","11:02:21",531,NA,NA,NA,"jfa","0.4.0","US",1560 +"2020-11-19","05:37:59",210808,NA,NA,NA,"jfa","0.4.0","US",590 +"2020-11-19","02:02:13",210160,NA,NA,NA,"jfa","0.4.0","CO",609 +"2020-11-19","05:58:44",211707,"3.4.1","x86_64","linux-gnu","jfa","0.4.0","TW",3698 +"2020-11-19","12:47:17",210817,NA,NA,NA,"jfa","0.4.0","US",596 +"2020-11-19","08:33:45",212917,NA,NA,NA,"jfa","0.4.0","US",7591 +"2020-11-19","08:33:45",528,NA,NA,NA,"jfa","0.4.0","US",7591 +"2020-11-19","08:33:45",212918,NA,NA,NA,"jfa","0.4.0","US",7591 +"2020-11-20","10:38:03",210808,NA,NA,NA,"jfa","0.4.0","US",1214 +"2020-11-20","01:28:43",211707,NA,NA,NA,"jfa","0.4.0","US",6885 +"2020-11-20","05:41:38",2825719,NA,NA,NA,"jfa","0.4.0","US",27 +"2020-11-20","09:51:40",210078,NA,NA,NA,"jfa","0.4.0","US",1214 +"2020-11-20","13:28:01",211707,"3.5.2","x86_64","linux-gnu","jfa","0.4.0","VE",94798 +"2020-11-20","09:51:40",210085,NA,NA,NA,"jfa","0.4.0","US",1214 +"2020-11-20","09:51:40",537,NA,NA,NA,"jfa","0.4.0","US",1214 +"2020-11-20","10:38:03",210815,NA,NA,NA,"jfa","0.4.0","US",1214 +"2020-11-20","09:10:38",189437,NA,NA,NA,"jfa","0.1.0","US",27019 +"2020-11-20","09:10:38",534,NA,NA,NA,"jfa","0.1.0","US",27019 +"2020-11-20","09:10:38",189430,NA,NA,NA,"jfa","0.1.0","US",27019 +"2020-11-20","10:38:03",537,NA,NA,NA,"jfa","0.4.0","US",1214 +"2020-11-21","09:26:06",528,NA,NA,NA,"jfa","0.1.0","US",7272 +"2020-11-21","09:26:06",189430,NA,NA,NA,"jfa","0.1.0","US",7272 +"2020-11-21","09:26:06",189431,NA,NA,NA,"jfa","0.1.0","US",7272 +"2020-11-21","12:28:31",211868,NA,NA,NA,"jfa","0.4.0","IQ",18 +"2020-11-21","01:07:02",210808,NA,NA,NA,"jfa","0.4.0","US",29 +"2020-11-21","10:59:24",210079,NA,NA,NA,"jfa","0.4.0","US",7272 +"2020-11-21","10:59:24",210078,NA,NA,NA,"jfa","0.4.0","US",7272 +"2020-11-21","10:59:24",531,NA,NA,NA,"jfa","0.4.0","US",7272 +"2020-11-21","16:11:49",211874,"3.6.3","x86_64","mingw32","jfa","0.4.0","CH",3222 +"2020-11-21","09:48:22",531,NA,NA,NA,"jfa","0.4.0","US",7272 +"2020-11-21","09:48:22",210808,NA,NA,NA,"jfa","0.4.0","US",7272 +"2020-11-21","09:48:22",210809,NA,NA,NA,"jfa","0.4.0","US",7272 +"2020-11-22","11:40:34",210815,NA,NA,NA,"jfa","0.4.0","US",11228 +"2020-11-22","11:40:34",210808,NA,NA,NA,"jfa","0.4.0","US",11228 +"2020-11-22","11:40:34",537,NA,NA,NA,"jfa","0.4.0","US",11228 +"2020-11-22","08:41:57",189431,NA,NA,NA,"jfa","0.1.0","US",11228 +"2020-11-22","08:41:57",534,NA,NA,NA,"jfa","0.1.0","US",11228 +"2020-11-22","08:41:57",189430,NA,NA,NA,"jfa","0.1.0","US",11228 +"2020-11-22","12:57:39",211868,"4.0.3","x86_64","mingw32","jfa","0.4.0","IT",2726 +"2020-11-22","11:53:21",210078,NA,NA,NA,"jfa","0.4.0","US",19265 +"2020-11-22","11:53:21",210085,NA,NA,NA,"jfa","0.4.0","US",19265 +"2020-11-22","11:53:21",537,NA,NA,NA,"jfa","0.4.0","US",19265 +"2020-11-22","21:46:49",210808,NA,NA,NA,"jfa","0.4.0","US",36 +"2020-11-23","09:50:54",528,NA,NA,NA,"jfa","0.1.0","US",5 +"2020-11-23","09:50:54",189437,NA,NA,NA,"jfa","0.1.0","US",5 +"2020-11-23","09:50:54",189430,NA,NA,NA,"jfa","0.1.0","US",5 +"2020-11-23","13:44:46",211867,"3.5.2","x86_64","linux-gnu","jfa","0.4.0","US",2069 +"2020-11-23","23:49:17",14523,NA,NA,NA,"jfa","0.4.0","US",22118 +"2020-11-23","23:49:31",14525,NA,NA,NA,"jfa","0.4.0","US",15723 +"2020-11-23","23:49:55",14523,NA,NA,NA,"jfa","0.4.0","US",3186 +"2020-11-23","15:49:41",211867,NA,NA,NA,"jfa","0.4.0","US",2069 +"2020-11-23","12:23:05",210808,NA,NA,NA,"jfa","0.4.0","US",29442 +"2020-11-23","12:23:05",210809,NA,NA,NA,"jfa","0.4.0","US",29442 +"2020-11-23","12:23:05",531,NA,NA,NA,"jfa","0.4.0","US",29442 +"2020-11-23","10:11:17",531,NA,NA,NA,"jfa","0.4.0","US",5 +"2020-11-23","10:11:17",210078,NA,NA,NA,"jfa","0.4.0","US",5 +"2020-11-23","10:11:17",210079,NA,NA,NA,"jfa","0.4.0","US",5 +"2020-11-23","16:41:24",211868,NA,NA,NA,"jfa","0.4.0","DE",2328 diff --git a/man/figures/readme/worldmap/worldmap.svg b/man/figures/readme/worldmap/worldmap.svg index cb16bff4b..34c1c72ea 100644 --- a/man/figures/readme/worldmap/worldmap.svg +++ b/man/figures/readme/worldmap/worldmap.svg @@ -64,16 +64,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -232,7 +232,7 @@ - + diff --git a/man/manual/jfa_0.5.0.pdf b/man/manual/jfa_0.5.0.pdf index ef9d43221..df498b563 100644 Binary files a/man/manual/jfa_0.5.0.pdf and b/man/manual/jfa_0.5.0.pdf differ diff --git a/man/report.Rd b/man/report.Rd new file mode 100644 index 000000000..659662332 --- /dev/null +++ b/man/report.Rd @@ -0,0 +1,55 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/report.R +\name{report} +\alias{report} +\title{Generate an Audit Report} +\usage{ +report(object = NULL, file = NULL, format = "html_document") +} +\arguments{ +\item{object}{an object of class 'jfaEvaluation' as returned by the \code{evaluation()} function.} + +\item{file}{a string that gives the desired name of the file (e.g. \code{"report.html"}). The report is created in your current working directory.} + +\item{format}{can be either one of \code{"html_document"} or \code{"pdf_document"} (required MikTex).} +} +\value{ +A html or pdf report containing the results of the evaluation. +} +\description{ +This function takes an object of class \code{jfaEvaluation}, creates a report containing the results, and saves the report to a file in your working directory. + +For more details on how to use this function see the package vignette: +\code{vignette("jfa", package = "jfa")} +} +\examples{ +library(jfa) +set.seed(1) + +# Generate some audit data (N = 1000): +data <- data.frame(ID = sample(1000:100000, size = 1000, replace = FALSE), + bookValue = runif(n = 1000, min = 700, max = 1000)) + +# Using monetary unit sampling, draw a random sample from the population. +s1 <- selection(population = data, sampleSize = 100, units = "mus", + bookValues = "bookValue", algorithm = "random") +s1_sample <- s1$sample +s1_sample$trueValue <- s1_sample$bookValue +s1_sample$trueValue[2] <- s1_sample$trueValue[2] - 500 # One overstatement is found + +e2 <- evaluation(sample = s1_sample, bookValues = "bookValue", auditValues = "trueValue", + method = "stringer", materiality = 0.05, counts = s1_sample$counts) + +# Generate report +# report(e2, file = "myFile.html") + +} +\seealso{ +\code{\link{evaluation}} +} +\author{ +Koen Derks, \email{k.derks@nyenrode.nl} +} +\keyword{audit} +\keyword{evaluation} +\keyword{report} diff --git a/tests/testthat/test-function-evaluation.R b/tests/testthat/test-function-evaluation.R index 2720b5c99..affa5aa68 100644 --- a/tests/testthat/test-function-evaluation.R +++ b/tests/testthat/test-function-evaluation.R @@ -155,7 +155,7 @@ test_that(desc = "(id: f5-v0.1.0-t13) Evaluation with direct method", { BuildIt$inSample <- c(rep(1, 100), rep(0, 3400)) BuildIt_sample <- subset(BuildIt, BuildIt$inSample == 1) jfaEval <- evaluation(materiality = 0.05, sample = BuildIt_sample, bookValues = "bookValue", auditValues = "auditValue", method = "direct", N = 3500, populationBookValue = sum(BuildIt$bookValue)) - expect_equal(jfaEval[["pointEstimate"]], 59580.62, tolerance = 0.001) + expect_equal(jfaEval[["mle"]], 59580.62, tolerance = 0.001) expect_equal(jfaEval[["lowerBound"]], -59050.61, tolerance = 0.001) expect_equal(jfaEval[["upperBound"]], 178211.9, tolerance = 0.001) }) @@ -165,7 +165,7 @@ test_that(desc = "(id: f5-v0.1.0-t14) Evaluation with difference method", { BuildIt$inSample <- c(rep(1, 100), rep(0, 3400)) BuildIt_sample <- subset(BuildIt, BuildIt$inSample == 1) jfaEval <- evaluation(materiality = 0.05, sample = BuildIt_sample, bookValues = "bookValue", auditValues = "auditValue", method = "difference", N = 3500, populationBookValue = sum(BuildIt$bookValue)) - expect_equal(jfaEval[["pointEstimate"]], 34298.6, tolerance = 0.001) + expect_equal(jfaEval[["mle"]], 34298.6, tolerance = 0.001) expect_equal(jfaEval[["lowerBound"]], 3437.26, tolerance = 0.001) expect_equal(jfaEval[["upperBound"]], 65159.94, tolerance = 0.001) }) @@ -175,7 +175,7 @@ test_that(desc = "(id: f5-v0.1.0-t15) Evaluation with quotient method", { BuildIt$inSample <- c(rep(1, 100), rep(0, 3400)) BuildIt_sample <- subset(BuildIt, BuildIt$inSample == 1) jfaEval <- evaluation(materiality = 0.05, sample = BuildIt_sample, bookValues = "bookValue", auditValues = "auditValue", method = "quotient", N = 3500, populationBookValue = sum(BuildIt$bookValue)) - expect_equal(jfaEval[["pointEstimate"]], 34298.6, tolerance = 0.001) + expect_equal(jfaEval[["mle"]], 34298.6, tolerance = 0.001) expect_equal(jfaEval[["lowerBound"]], 3138.557, tolerance = 0.001) expect_equal(jfaEval[["upperBound"]], 65458.64, tolerance = 0.001) }) @@ -185,7 +185,7 @@ test_that(desc = "(id: f5-v0.1.0-t16) Evaluation with regression method", { BuildIt$inSample <- c(rep(1, 100), rep(0, 3400)) BuildIt_sample <- subset(BuildIt, BuildIt$inSample == 1) jfaEval <- evaluation(materiality = 0.05, sample = BuildIt_sample, bookValues = "bookValue", auditValues = "auditValue", method = "regression", N = 3500, populationBookValue = sum(BuildIt$bookValue)) - expect_equal(jfaEval[["pointEstimate"]], 33872, tolerance = 0.001) + expect_equal(jfaEval[["mle"]], 33872, tolerance = 0.001) expect_equal(jfaEval[["lowerBound"]], 3069.264, tolerance = 0.001) expect_equal(jfaEval[["upperBound"]], 64674.73, tolerance = 0.001) }) @@ -255,7 +255,7 @@ test_that(desc = "(id: f5-v0.5.0-t1) Test for frequentist print function", { BuildIt_sample <- subset(BuildIt, BuildIt$inSample == 1) jfaEval <- evaluation(materiality = 0.05, sample = BuildIt_sample, bookValues = "bookValue", auditValues = "auditValue", method = "regression", N = 3500, populationBookValue = sum(BuildIt$bookValue)) invisible(capture.output(print(jfaEval))) - expect_equal(jfaEval[["pointEstimate"]], 33872, tolerance = 0.001) + expect_equal(jfaEval[["mle"]], 33872, tolerance = 0.001) }) test_that(desc = "(id: f5-v0.2.0-t2) Test for Bayesian print function", { diff --git a/tests/testthat/test-other.R b/tests/testthat/test-other.R new file mode 100644 index 000000000..da14376e7 --- /dev/null +++ b/tests/testthat/test-other.R @@ -0,0 +1,8 @@ +context("9. Other tests") + +# jfa version 0.5.0 + +test_that(desc = "(id: f9-v0.5.0-t1) Function test .getfun()", { + x <- jfa:::.getfun("rmarkdown::render") + expect_equal(length(x), 1) +})