aboutsummaryrefslogtreecommitdiff
path: root/R/sigma_twocomp.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-10-25 00:37:42 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2019-10-25 02:03:54 +0200
commit0a3eb0893cb4bd1b12f07a79069d1c7f5e991495 (patch)
tree1bf0ffeb710b3438fee224d0a657606b4c36b495 /R/sigma_twocomp.R
parent053bf27d3f265c7a7378e2df3e00cf891e0d1bb2 (diff)
Use roxygen for functions and methods
Diffstat (limited to 'R/sigma_twocomp.R')
-rw-r--r--R/sigma_twocomp.R26
1 files changed, 26 insertions, 0 deletions
diff --git a/R/sigma_twocomp.R b/R/sigma_twocomp.R
index b06816c1..c9a15aa8 100644
--- a/R/sigma_twocomp.R
+++ b/R/sigma_twocomp.R
@@ -1,3 +1,29 @@
+#' Two component error model
+#'
+#' Function describing the standard deviation of the measurement error in
+#' dependence of the measured value \eqn{y}:
+#'
+#' \deqn{\sigma = \sqrt{ \sigma_{low}^2 + y^2 * {rsd}_{high}^2}} sigma =
+#' sqrt(sigma_low^2 + y^2 * rsd_high^2)
+#'
+#' This is the error model used for example by Werner et al. (1978). The model
+#' proposed by Rocke and Lorenzato (1995) can be written in this form as well,
+#' but assumes approximate lognormal distribution of errors for high values of
+#' y.
+#'
+#' @param y The magnitude of the observed value
+#' @param sigma_low The asymptotic minimum of the standard deviation for low
+#' observed values
+#' @param rsd_high The coefficient describing the increase of the standard
+#' deviation with the magnitude of the observed value
+#' @return The standard deviation of the response variable.
+#' @references Werner, Mario, Brooks, Samuel H., and Knott, Lancaster B. (1978)
+#' Additive, Multiplicative, and Mixed Analytical Errors. Clinical Chemistry
+#' 24(11), 1895-1898.
+#'
+#' Rocke, David M. and Lorenzato, Stefan (1995) A two-component model for
+#' measurement error in analytical chemistry. Technometrics 37(2), 176-184.
+#' @export
sigma_twocomp <- function(y, sigma_low, rsd_high) {
sqrt(sigma_low^2 + y^2 * rsd_high^2)
}

Contact - Imprint