y2z | R Documentation |
Converts measurements into age- or hgt-conditional standard deviation scores (SDS, Z-score) using one or more external reference distributions.
y2z(
y,
x,
refcode,
pkg = "centile",
verbose = FALSE,
dec = 3L,
rule = 1L,
tail_adjust = FALSE,
...
)
y |
A numerical vector with measurements'. |
x |
A vector containing |
refcode |
A character vector with |
pkg |
The package containing the references in the |
verbose |
Set to |
dec |
A scalar value indicating the number of decimals used to round the value. The default is 3 decimals. |
rule |
an integer (of length 1 or 2) describing how interpolation
is to take place outside the interval [ |
tail_adjust |
Logical. If |
... |
Not used. |
A vector with length(y)
elements containing the Z-scores.
The type of reference distribution is defined by the distribution
field
of the study
attribute in the reference. The function executes
transformations specified by the tx
and ty
fields before calculating the
Z-score.
Functions y2z()
and z2y()
functions are the inverse of each other.
Stef van Buuren, 2021
# Weight SD 1 month old boy and girl of 4 KG using built-in WHO references
y <- c(4, 4)
x <- c(1/12, 1/12)
refcode <- c("who_2006_wgt_male_", "who_2006_wgt_female_")
y2z(y, x, refcode)
# using external reference, for females only
fn <- system.file("testdata/nl_2009_wgt_female_nl.txt", package = "centile")
myref <- import_rif(fn)
head(myref)
head(attr(myref, "study"))
y2z(y, x, myref)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.