cdcanthro: standardized growth metrics from the CDC and WHO growth charts

cdcanthro calculates sex- and age-standardized z-scores, percentiles and related metrics for weight, height (or length), BMI and head circumference in children, using the LMS (lambda-mu-sigma) method and the reference tables of the CDC Growth Charts and the WHO Child Growth Standards.

Three functions:

Function Reference Ages Main outputs
cdc_z() 2000 CDC Growth Charts 24 to < 240 months waz, haz, bmiz, bmip (extended z-scores and percentiles for BMIs >= 95th percentile), bmip95, modified z-scores
who_z() WHO Child Growth Standards 2006 0 to 1826 days (5 y) who_waz, who_lhaz, who_bmiz, who_wflz, who_headcz, plus biologically-implausible-value flags
gradual_z() Daymont et al. 2025 2 to 5 years grad_waz, grad_haz, grad_bmiz: a weighted average of the WHO and CDC z-scores that removes the jump at age 2

CDC recommends the WHO standards under 24 months and the CDC charts from 24 months. Switching references on a child's second birthday creates a discontinuity -- a girl weighing 9.9 kg is at the WHO 10th percentile the day before her second birthday and at the CDC 2nd percentile the day after. gradual_z() blends the two z-scores linearly between 2 and 5 years so the transition is continuous.

cdc_z() reproduces the output of the CDC SAS program, including the extended BMI metrics of Wei et al. (2020) and Hales et al. (2022) for children with obesity, and is checked against SAS output in the package tests. The functions are written with data.table so they're fast even in very large (eg, 100 M records) datasets.

Installation

From CRAN:

install.packages("cdcanthro")

Development version from GitHub:

# install.packages("remotes")
# remotes::install_github("CDC-DNPAO/cdcanthro")
install.packages("cdcanthro", repos = c('https://cdc-dnpao.r-universe.dev', 'https://cloud.r-project.org'))

Usage

The input is a data.frame, data.table or tibble with a column named sex (coded 1/2, M/F, boy/girl, male/female -- case-insensitive; other numeric codings via sex_code) and whatever measurements are available. Column names can be given quoted or unquoted. The same class of object is returned, with the new columns added.

library(cdcanthro)
library(data.table)

# CDC charts, ages 24 to < 240 months. NHanes is an example dataset in
# the package; its ages are completed months, so 0.5 is added (with a
# warning) to place each child at the midpoint of the month.
d <- copy(NHanes)
out <- cdc_z(d, age = agemos, wt = wt, ht = ht, bmi = bmi)
out[, .(seqn, sex, agemos, waz, haz, bmiz, bmip, bmip95)]

# WHO standards, ages 0 to 1826 days. lenhei is recumbent length through
# 730 days and standing height after that.
d[, lenhei := fifelse(agedays <= 730, length, ht)]
young <- who_z(d[agedays <= 1826], agedays = agedays, wt = wt,
               lenhei = lenhei, headc = headc)
young[, .(seqn, agedays, who_waz, who_lhaz, who_bmiz, who_wflz, fwaz)]

# Gradual WHO-to-CDC transition for 2- to 5-year-olds. After who_z() and
# cdc_z() have both been run on the same data, the default column names
# line up and no arguments other than the data are needed.
both <- cdc_z(young, age = agemos, wt = wt, ht = ht)
gradual_z(both)[, .(agedays, who_waz, waz, grad_waz)]

Notes:

See ?cdc_z, ?who_z and ?gradual_z for the full list of output variables and the formulas used, and NEWS.md for changes by version.

Conventions

Age units. Each function takes age in the unit its reference tables use:

Function Age argument Unit Range with results
cdc_z() age months 24.0 to < 240
who_z() agedays days 0 to 1826
gradual_z() agedays days any (blends 731 to 1825)

Give age as precisely as you have it. If ages are completed months (integers, as NHANES releases them), add 0.5 so that 36 means the midpoint of month 36; cdc_z() does this itself, with a warning, when every age is a whole number. To convert days to months divide by 30.4375; to convert completed months to days, add 0.5, multiply by 30.4375 and round.

Output names. CDC z-scores for weight, height and BMI have bare names (waz, haz, bmiz, bmip, ...); WHO z-scores are prefixed who_ (who_waz, who_lhaz, ...); WHO plausibility flags are prefixed f (fwaz, flhaz, ...); gradual z-scores are prefixed grad_ (grad_waz, ...). In cdc_z() output, bmiz/bmip are the extended values above the 95th percentile and orig_bmiz/orig_bmip are the LMS-only values. Because the three sets of names never collide, who_z() and cdc_z() can be run on the same data and gradual_z(data) then needs no other arguments -- its defaults are exactly their output names.

Two deliberate departures from a plain LMS calculation. For BMI at or above the CDC 95th percentile, cdc_z() returns the extended z-score and percentile of Wei et al. (2020) and Hales et al. (2022), which model BMI above the 95th percentile as half-normal instead of extrapolating the Box-Cox transformation. For the weight-based WHO indicators (who_waz, who_wflz, who_bmiz), who_z() applies WHO's restricted application of the LMS method beyond +/-3 SD, as WHO's own igrowup macros and the anthro package do.

Validation. cdc_z() is checked against output of the CDC SAS program on a fixture of children's measurements (tests/testthat/fixtures/sas_cdc.csv), with agreement to 1e-6 for every metric the SAS program produces. Both functions also have round-trip tests (a measurement constructed to sit at z returns z) and stored reference outputs for a fixed set of children, so an internal code change that alters any result is caught by the tests rather than passing unnoticed.

References

Citation

citation("cdcanthro")

Bug reports

Please use the issue tracker.