R/standard_who.R
who_value2zscore.Rd
Compute z-scores or centiles with respect to the WHO growth standard for given values of x vs. y (typically x is "agedays" and y is a measure like "htcm").
who_value2zscore(
x,
y,
x_var = "agedays",
y_var = "lenhtcm",
sex = "Female",
data = NULL
)
who_value2centile(
x,
y,
x_var = "agedays",
y_var = "lenhtcm",
sex = "Female",
data = NULL
)
value or vector of values that correspond to a measure defined by x_var
value or vector of values that correspond to a measure defined by y_var
x variable name (typically "agedays") - see details
y variable name (typically "htcm", "lencm", or "wtkg") - see details
"Male" or "Female"
optional data frame that supplies any of the other variables provided to the function
for all supported pairings of y_var
and x_var
, type names(who_coefs)
# z-scores
who_value2zscore(1670, in2cm(44))
#> [1] 1.117365
who_value2zscore(1670, lb2kg(48), y_var = "wtkg")
#> [1] 1.527048
who_value2centile(1670, in2cm(44))
#> [1] 86.80809
who_value2centile(1670, lb2kg(48), y_var = "wtkg")
#> [1] 93.66255
# add haz derived from WHO data and compare to that provided with data
cpp$haz <- who_value2zscore(x = agedays, y = lencm, sex = sex, data = cpp)
# note that you can also do it this way
#' cpp$haz <- who_value2zscore(cpp$agedays, cpp$lencm, sex = cpp$sex)