Calculates the z or z(log) values for laboratory measurement standardisation as proposed in Hoffmann 2017 et al.
numeric
, laboratory values.
numeric
or matrix
, lower and upper reference limits. Has to
be of length 2 for numeric
or a two-column matrix
with as many rows as
elements in x
.
numeric
, probabilities of the lower and upper reference limit,
default: c(0.025, 0.975)
(spanning 95 %). Has to be of length 2 for
numeric
or a two-column matrix
with as many rows as elements in x
.
logical
, should z (log = FALSE
, default) or
z(log) (log = TRUE
) calculated?
numeric
, z or z(log) values.
The z value is calculated as follows (assuming that the limits where 0.025 and 0.975 quantiles): \(z = (x - (limits_1 + limits_2 )/2) * 3.92/(limits_2 - limits_1)\).
The z(log) value is calculated as follows (assuming that the limits where 0.025 and 0.975 quantiles): \(z = (\log(x) - (\log(limits_1) + \log(limits_2))/2) * 3.92/(\log(limits_2) - \log(limits_1))\).
zlog
is an alias for z(..., log = TRUE)
.
Georg Hoffmann, Frank Klawonn, Ralf Lichtinghagen, and Matthias Orth. 2017. "The Zlog-Value as Basis for the Standardization of Laboratory Results." LaboratoriumsMedizin 41 (1): 23–32. doi:10.1515/labmed-2016-0087 .
z(1:10, limits = c(2, 8))
#> [1] -2.6132853 -1.9599640 -1.3066427 -0.6533213 0.0000000 0.6533213
#> [7] 1.3066427 1.9599640 2.6132853 3.2666066
# from Hoffmann et al. 2017
albumin <- c(42, 34, 38, 43, 50, 42, 27, 31, 24)
zlog(albumin, limits = c(35, 52))
#> [1] -0.15472223 -2.24698167 -1.14569028 0.07826303 1.57162335 -0.15472223
#> [7] -4.52949253 -3.16160843 -5.69571148
bilirubin <- c(11, 9, 2, 5, 22, 42, 37, 200, 20)
limits <- cbind(
lower = rep(c(35, 2), c(length(albumin), length(bilirubin))),
upper = rep(c(52, 21), c(length(albumin), length(bilirubin)))
)
zlog(c(albumin, bilirubin), limits = limits)
#> [1] -0.15472223 -2.24698167 -1.14569028 0.07826303 1.57162335 -0.15472223
#> [7] -4.52949253 -3.16160843 -5.69571148 0.88198551 0.54745164 -1.95996398
#> [13] -0.43243508 2.03751652 3.11549499 2.90418990 5.71721785 1.87862693