Package 'anthro'

Title: Computation of the WHO Child Growth Standards
Description: Provides WHO Child Growth Standards (z-scores) with confidence intervals and standard errors around the prevalence estimates, taking into account complex sample designs. More information on the methods is available online: <https://www.who.int/tools/child-growth-standards>.
Authors: Dirk Schumacher [aut, cre], Elaine Borghi [ctb], Jonathan Polonsky [ctb], World Health Organization [cph]
Maintainer: Dirk Schumacher <[email protected]>
License: GPL-3
Version: 1.0.1.9000
Built: 2024-11-01 11:17:14 UTC
Source: https://github.com/worldhealthorganization/anthro

Help Index


Compute the WHO Child Growth Standards

Description

Provides WHO Child Growth Standards (z-scores) with confidence intervals and standard errors around the prevalence estimates, taking into account complex sample designs. More information on the methods is available online: <https://www.who.int/tools/child-growth-standards>.

Author(s)

Maintainer: Dirk Schumacher [email protected]

Other contributors:

See Also

Useful links:


Compute prevalence of zscores

Description

Compute prevalence of zscores

Usage

anthro_api_compute_prevalence(data, zscores_to_compute, survey_subsets)

Arguments

data

a data frame containing the underlying data

zscores_to_compute

a list of zscore indicators that should be computed. The list needs to have 4 named values:

name

The name or abbreviation of the indicator. This will appear in the column names of the output.

column

The column name without the 'z' of the zscore that shall be used.

with_cutoffs

TRUE iff cutoffs for the indicator shall be computed.

with_auxiliary_zscore_column

TRUE iff z-score should be set to -3.1 if oedema = "y" for prevalence estimates.

auxiliary_zscore_condition

optional function to define a special condition when the z-score should be set to -3.1

survey_subsets

subsets for which the prevalence values should be computed. It is a named list of characters, where the values correspond to columns and the names to labels in the output.

Note

This function is meant to be used by other anthro related packages. It is not advised to use this in you own packages or analysis. If you must use it, prepare for potential breaking changes in the future.


Helper function to compute zscores

Description

Helper function to compute zscores

Usage

anthro_api_compute_zscore(y, m, l, s)

Arguments

y

a numeric vector

m

a numeric vector

l

a numeric vector

s

a numeric vector

Note

This function is meant to be used by other anthro related packages. It is not advised to use this in you own packages or analysis. If you must use it, prepare for potential breaking changes in the future.

References

http://www.who.int/childgrowth/standards/Chap_7.pdf


Helper function to compute the adjusted zscore

Description

Helper function to compute the adjusted zscore

Usage

anthro_api_compute_zscore_adjusted(y, m, l, s)

Arguments

y

a numeric vector

m

a numeric vector

l

a numeric vector

s

a numeric vector

Note

This function is meant to be used by other anthro related packages. It is not advised to use this in you own packages or analysis. If you must use it, prepare for potential breaking changes in the future.

References

http://www.who.int/childgrowth/standards/Chap_7.pdf


Standardize the Oedema input values

Description

Standardize the Oedema input values

Usage

anthro_api_standardize_oedema_var(oedema)

Arguments

oedema

a vector of values

Note

This function is meant to be used by other anthro related packages. It is not advised to use this in you own packages or analysis. If you must use it, prepare for potential breaking changes in the future.


Standardize the Sex input values

Description

Standardize the Sex input values

Usage

anthro_api_standardize_sex_var(sex)

Arguments

sex

a vector of values

Note

This function is meant to be used by other anthro related packages. It is not advised to use this in you own packages or analysis. If you must use it, prepare for potential breaking changes in the future.


Compute prevalence estimates

Description

Prevalence estimates according to the WHO recommended standard analysis: includes prevalence estimates with corresponding standard errors and confidence intervals, and z-score summary statistics (mean and standard deviation) with most common cut-offs describing the full index distribution (-3, -2, -1, +1, +2, +3), and at disaggregated levels for all available factors (age, sex, type of residence, geographical regions, wealth quintiles, mother education and one additional factor the user is interested in and for which data are available).

Usage

anthro_prevalence(
  sex,
  age = NA_real_,
  is_age_in_month = FALSE,
  weight = NA_real_,
  lenhei = NA_real_,
  measure = NA_character_,
  oedema = "n",
  sw = NULL,
  cluster = NULL,
  strata = NULL,
  typeres = NA_character_,
  gregion = NA_character_,
  wealthq = NA_character_,
  mothered = NA_character_,
  othergr = NA_character_
)

Arguments

sex

A numeric or text variable containing gender information. If it is numeric, its values must be: 1 for males and 2 for females. If it is character, it must be "m" or "M" for males and "f" or "F" for females. No z-scores will be calculated if sex is missing.

age

A numeric variable containing age information; age can be in either days or months (if optional argument is_age_in_month is set to TRUE). An exact age in days is expected and should not be rounded if age is in months. Age-related z-scores will NOT be calculated if age is missing (NA).

is_age_in_month

A logical flag; if TRUE, variable age unit will be treated as months. The function converts it to days by dividing age by 30.4375 and rounding it to integer so that reference tables can be used. When unspecified, the default value FALSE is used and age unit is treated as days.

weight

A numeric variable containing body weight information, which must be in kilograms. Weight-related z-scores are not calculated if body weight is missing.

lenhei

A numeric variable containing length (recumbent length) or height (standing height) information, which must be in centimeters. Length/height-related z-scores will not be calculated if lenhei is missing. For children with age below 24 months (i.e. below 731 days) and standing height measured, the function converts it to recumbent length by adding 0.7 cm; and for children with age equal and above 24 months and measured in recumbent length, the function converts it to standing height by subtracting 0.7 cm. This way all the z-scores calculated by this function are length-based for children below 24 months, and height-based otherwise. This converted length/height according to age is assigned to the variable clenhei in the resulting data.frame.

measure

A character variable indicating whether recumbent length or standing height was measured for each observation. The values of this variable must be "L" or "l" for recumbent length, and "H" or "h" for standing height. Although it is highly recommended that this variable is provided according to the measurements taken in the survey, it is possible to run the analysis without specifying this variable. If unspecified, the default vector with all missing values is used. The function imputes the missing values according to the following algorithm:

  • If age is not missing, then it is recumbent length if age below 24 months (731 days), and standing height if age equal and above 24 months.

  • If age is missing, then it is recumbent length if measurement < 87 cm and standing height if measurement >= 87 cm.

oedema

The values of this character variable must be "n", "N" or "2" for non-oedema, and "y", "Y", "1" for oedema. Although it is highly recommended that this variable is provided by the survey, it is possible to run the analysis without specifying this variable. If unspecified, the default vector of all "n" with values considered as non-oedema is used. Missing values will be treated as non-oedema. For oedema, weight related z-scores (zwei, zwfl and zbmi) are NOT calculated (set to missing), BUT they are treated as being < -3 SD in the weight-related indicator prevalence (anthro_prevalence) estimation.

sw

An optional numeric vector containing the sampling weights. If NULL, no sampling weights are used.

cluster

An optional integer vector representing clusters. If the value is NULL this is treated as a survey without a cluster. This is also the case if all values are equal, then we assume there is also no cluster.

strata

An optional integer vector representing strata. Pass NULL to indicate that there are no strata.

typeres

An optional integer or character vector representing a type of residence. Any values are accepted, however, “Rural” or “Urban” are preferable for outputs purposes.

gregion

An optional integer or character vector representing a geographical region.

wealthq

An optional integer or character vector representing wealth quintiles where (1=poorest; 2,3,4,5=richest). All values can either be NA, or 1, 2, 3, 4, 5 or Q1, Q2, Q3, Q4, Q5.

mothered

An optional integer or character vector representing the education of the mother. Any number of categories is accepted for the analysis, provided sample sizes are sufficient in all categories. However, the common, standard recommended categories are no education, primary school, and secondary school or higher (“None”, “Primary” and “Secondary”). Note: Mother education refers to the highest level of schooling attained by the mother

othergr

An optional integer or character vector that is of interest for stratified analysis.

Details

In this function, all available (non-missing and non-flagged) z-score values are used for each indicator-specific prevalence estimation (standard analysis).

Note: the function temporarily sets the survey option survey.lonely.psu to "adjust" and then restores the original values. The function is a wrapper around the survey package to compute estimates for the different groups (e.g. by age or sex).

If not all parameter values have equal length, parameter values will be repeated to match the maximum length of all arguments except is_age_in_month using rep_len. This happens without warnings.

Value

Returns a data.frame with prevalence estimates for the various groups.

The output data frame includes prevalence estimates with corresponding standard errors and confidence intervals, and z-score summary statistics (mean and standard deviation) with most common cut-offs describing the full index distribution (-3, -2, -1, +1, +2, +3), and at disaggregated levels for all available factors (age, sex, type of residence, geographical regions, wealth quintiles, mother education and one additional factor the user is interested in and for which data are available).

The resulting columns are coded with a prefix, a prevalence indicator and a suffix:

Prefix:

HA

Height-for-age

WA

Weight-for-age

WA_2

Underweight

BMI

Body-mass-index-for-age

WH

Weight-for-height

HA_WH

Height-for-age and weight-for-height combined

Prevalence indicator:

_3

Prevalence corresponding to < -3 SD

_2

Prevalence corresponding to < -2 SD

_1

Prevalence corresponding to < -1 SD

1

Prevalence corresponding to > +1 SD

2

Prevalence corresponding to > +2 SD

3

Prevalence corresponding to > +3 SD

Suffix:

_pop

Weighted sample size

_unwpop

Unweighted sample size

_r

Mean/prevalence

_ll

lower 95% confidence interval limit

_ul

upper 95% confidence interval limit

_stdev

Standard Deviation

_se

Standard error

For example:

WHZ_pop

Weight-for-height weighted sample size

HA_r

Height-for-age z-score mean

WA_stdev

Weight-for-age z-score Standard Deviation

WH2_r

Prevalence of weight-for-height >+2 SD (overweight )

WH_r

Mean weight-for-height z-score

BMI_2_se

Prevalence of BMI-for-age <-2 SD standard error

BMI_3_ll

Prevalence of BMI-for-age <-3 SD lower 95% confidence interval limit

HA_2_WH_2_ul

Prevalence of children Height-for-age and weight-for-height combined (stunted & wasted) lower 95% confidence interval limit

Methods:

The survey package is used to compute all estimates. Confidence intervals are computed with a significance level of 0.05. svymean is used the z-score mean and CIs, while for the prevalence estimates svyciprop is used with the logit method.

For cases where cluster/strata/sw is NULL a fast approximation is used that does not use the survey package but computes the same results within bounds (maximum empirical difference is < 0.0001).

References

T. Lumley (2024) "survey: analysis of complex survey samples". R package version 4.4.

Examples

## Not run: 
# because it takes too long for CRAN checks
library(anthro)

# compute the prevalence estimates for 100 random children
# with weight around 15kg and height around 100cm
res <- anthro_prevalence(
  sex = c(1, 2),
  age = 1000, # days
  weight = rnorm(100, 15, 1),
  lenhei = rnorm(100, 100, 10)
)

# Height-for-age
# We extract prevalence estimates for <-3SD, <-2SD (Stunting)
# and the z-score mean
col_names <- c("Group", "HAZ_unwpop", "HA_3_r", "HA_2_r", "HA_r")
res <- res[, col_names]

# rename the columns
colnames(res) <- c("Group", "Unweighted N", "-3SD", "-2SD", "z-score mean ")

# note that we only generated data for one age group
res

## End(Not run)

Calculate z-scores for the eight anthropometric indicators

Description

This function calculates z-scores for the eight anthropometric indicators, weight-for- age, length/height-for-age, weight-for-length/height, body mass index (BMI)-for-age, head circumference-for-age, arm circumference-for-age, triceps skinfold-for-age and subscapular skinfold-for-age based on the WHO Child Growth Standards.

Usage

anthro_zscores(
  sex,
  age = NA_real_,
  is_age_in_month = FALSE,
  weight = NA_real_,
  lenhei = NA_real_,
  measure = NA_character_,
  headc = NA_real_,
  armc = NA_real_,
  triskin = NA_real_,
  subskin = NA_real_,
  oedema = "n"
)

Arguments

sex

A numeric or text variable containing gender information. If it is numeric, its values must be: 1 for males and 2 for females. If it is character, it must be "m" or "M" for males and "f" or "F" for females. No z-scores will be calculated if sex is missing.

age

A numeric variable containing age information; age can be in either days or months (if optional argument is_age_in_month is set to TRUE). An exact age in days is expected and should not be rounded if age is in months. Age-related z-scores will NOT be calculated if age is missing (NA).

is_age_in_month

A logical flag; if TRUE, variable age unit will be treated as months. The function converts it to days by dividing age by 30.4375 and rounding it to integer so that reference tables can be used. When unspecified, the default value FALSE is used and age unit is treated as days.

weight

A numeric variable containing body weight information, which must be in kilograms. Weight-related z-scores are not calculated if body weight is missing.

lenhei

A numeric variable containing length (recumbent length) or height (standing height) information, which must be in centimeters. Length/height-related z-scores will not be calculated if lenhei is missing. For children with age below 24 months (i.e. below 731 days) and standing height measured, the function converts it to recumbent length by adding 0.7 cm; and for children with age equal and above 24 months and measured in recumbent length, the function converts it to standing height by subtracting 0.7 cm. This way all the z-scores calculated by this function are length-based for children below 24 months, and height-based otherwise. This converted length/height according to age is assigned to the variable clenhei in the resulting data.frame.

measure

A character variable indicating whether recumbent length or standing height was measured for each observation. The values of this variable must be "L" or "l" for recumbent length, and "H" or "h" for standing height. Although it is highly recommended that this variable is provided according to the measurements taken in the survey, it is possible to run the analysis without specifying this variable. If unspecified, the default vector with all missing values is used. The function imputes the missing values according to the following algorithm:

  • If age is not missing, then it is recumbent length if age below 24 months (731 days), and standing height if age equal and above 24 months.

  • If age is missing, then it is recumbent length if measurement < 87 cm and standing height if measurement >= 87 cm.

headc

A numeric variable containing head circumference information, which must be in centimeters. Head circumference-for-age z-scores are not calculated if head circumference is missing.

armc

A numeric variable containing arm circumference information, which must be in centimeters. Arm circumference-for-age z-scores are not calculated if arm circumference is missing.

triskin

A numeric variable containing triceps skinfold information, which must be in millimeters. Triceps skinfold-for-age z-scores are not calculated if triceps skinfold is missing.

subskin

A numeric variable containing subscapular skinfold information, which must be in millimeters. Subscapular skinfold-for-age z-scores are not calculated if subscapular skinfold is missing.

oedema

The values of this character variable must be "n", "N" or "2" for non-oedema, and "y", "Y", "1" for oedema. Although it is highly recommended that this variable is provided by the survey, it is possible to run the analysis without specifying this variable. If unspecified, the default vector of all "n" with values considered as non-oedema is used. Missing values will be treated as non-oedema. For oedema, weight related z-scores (zwei, zwfl and zbmi) are NOT calculated (set to missing), BUT they are treated as being < -3 SD in the weight-related indicator prevalence (anthro_prevalence) estimation.

Value

A data.frame with three types of columns. Columns starting with a "c" are cleaned versions of the input arguments. Columns beginning with a "z" are the respective z-scores and columns prefixed by a "f" indicate if these z-scores are flagged (integers). The number of rows is given by the length of the input arguments.

The following columns are returned:

  • clenhei converted length/height for deriving z-score

  • cbmi BMI value based on length/height given by clenhei

  • zlen Length/Height-for-age z-score

  • flen 1, if abs(zlen) > 6

  • zwei Weight-for-age z-score

  • fwei 1, if zwei < -6 or zwei > 5

  • zwfl Weight-for-length/height z-score

  • fwfl 1, if abs(zwfl) > 5

  • zbmi BMI-for-age z-score

  • fbmi 1, if abs(zbmi) > 5

  • zhc Head circumference-for-age z-score

  • fhc 1, if abs(zhc) > 5

  • zac Arm circumference-for-age z-score

  • fac 1, if abs(zac) > 5

  • zts Triceps skinfold-for-age z-score

  • fts 1, if abs(zts) > 5

  • zss Subscapular skinfold-for-age z-score

  • fss 1, if abs(zss) > 5

If not all parameter values have equal length, parameter values will be repeated to match the maximum length of all arguments except is_age_in_month using rep_len. This happens without warnings.

Z-scores are only computed for children younger than 60 months (age in months < 60)

References

WHO Multicentre Growth Reference Study Group (2006). WHO Child Growth Standards: Length/height-for-age, weight-for-age, weight-for-length, weight-for-height and body mass index-for-age: Methods and development. Geneva: World Health Organization; pp 312. (web site: http://www.who.int/childgrowth/publications/en/ )

WHO Multicentre Growth Reference Study Group (2007). WHO Child Growth Standards: Head circumference-for-age, arm circumference-for-age, triceps skinfold-for-age and subscapular skinfold-for-age: Methods and development. Geneva: World Health Organization; pp 217. (web site: http://www.who.int/childgrowth/publications/en/ )

Examples

# you can either use the function to compute zscores for specific values
anthro_zscores(sex = "f", age = 10, is_age_in_month = TRUE, weight = 10)

# values will be recycled so not all input values need to be of the same length
anthro_zscores(sex = "f", age = c(10, 20, 30), weight = 10)

# or use it with a compute dataset
## Not run: 
your_data_set <- read.csv("<your survey>.csv")
with(
  your_data_set,
  anthro_zscores(
    sex = sex, age = age_in_days,
    weight = weight, lenhei = lenhei
  )
)

## End(Not run)