Skip to contents

Calculate z-scores for MUAC-for-age (MFAZ) and identify outliers based on the SMART methodology. When age is not supplied, wrangling will consist only in detecting outliers from the raw MUAC values. The function only works after the age has been wrangled.

Usage

mw_wrangle_muac(
  df,
  sex,
  muac,
  age = NULL,
  .recode_sex = TRUE,
  .recode_muac = TRUE,
  .to = c("cm", "mm", "none"),
  .decimals = 3
)

Arguments

df

A data set object of class data.frame to wrangle data from.

sex

A numeric or character vector of child's sex. Code values should only be 1 or "m" for males and 2 or "f" for females. Make sure sex values are coded in either of the aforementioned before calling the function. If input codes are different than expected, the function will stop execution and return an error message with the type of mismatch.

muac

A vector of class numeric of child's age in months. If the class is different than expected, the function will stop execution and return an error message indicating the type of mismatch.

age

A vector of class numeric of child's age in months.

.recode_sex

Logical. Set to TRUE if the values for sex are not coded as 1 (for males) or 2 (for females). Otherwise, set to FALSE (default).

.recode_muac

Logical. Set to TRUE if the values for raw MUAC should be converted to either centimeters or millimeters. Otherwise, set to FALSE (default)

.to

A choice of the measuring unit to which the MUAC values should be converted; "cm" for centimeters, "mm" for millimeters and "none" to leave as it is.

.decimals

The number of decimals places the z-scores should have. Default is 3.

Value

A data frame based on df. New variables named mfaz and flag_mfaz, of child's MFAZ and detected outliers, will be created. When age is not supplied, only flag_muac variable is created. This refers to outliers detected based on the raw MUAC values.

References

Bilukha, O., & Kianian, B. (2023). Considerations for assessment of measurement quality of mid‐upper arm circumference data in anthropometric surveys and mass nutritional screenings conducted in humanitarian and refugee settings. Maternal & Child Nutrition, 19, e13478. https://doi.org/10.1111/mcn.13478

SMART Initiative (2017). Standardized Monitoring and Assessment for Relief and Transition. Manual 2.0. Available at: https://smartmethodology.org.

Examples

## When age is available, wrangle it first before calling the function ----
w <- mw_wrangle_age(
  df = anthro.02,
  dos = NULL,
  dob = NULL,
  age = age,
  .decimals = 2
)

### Then apply the function to wrangle MUAC data ----
mw_wrangle_muac(
  df = w,
  sex = sex,
  age = age,
  muac = muac,
  .recode_sex = TRUE,
  .recode_muac = TRUE,
  .to = "cm",
  .decimals = 3
)
#> ================================================================================
#> # A tibble: 2,267 × 15
#>    province strata cluster   sex   age weight height edema  muac wtfactor   wfhz
#>    <chr>    <chr>    <int> <dbl> <dbl>  <dbl>  <dbl> <chr> <dbl>    <dbl>  <dbl>
#>  1 Zambezia Rural      391     2  6.01    8.2   68   n      15.2     825.  0.349
#>  2 Zambezia Rural      404     2  6.01    7.1   65.1 n      13.9     287. -0.006
#>  3 Zambezia Rural      399     2  6.11    7.6   64.1 n      15.5     130.  0.9  
#>  4 Zambezia Urban      430     2  6.14    7.9   65.9 n      14.8    1277.  0.876
#>  5 Zambezia Urban      468     2  6.28    6.6   59.7 n      13.2     792.  1.38 
#>  6 Zambezia Urban      517     2  6.34    6     61.8 n      12.9     480. -0.583
#>  7 Zambezia Urban      461     2  6.34    6.5   64.4 n      12.3     977. -0.732
#>  8 Zambezia Rural      382     2  6.41    6.5   63.4 n      12.6     165. -0.349
#>  9 Zambezia Urban      502     2  6.41    7.5   66   n      14.2    1083. -0.006
#> 10 Zambezia Urban      500     2  6.41    6.8   64.1 n      13.5     972. -0.441
#> # ℹ 2,257 more rows
#> # ℹ 4 more variables: flag_wfhz <dbl>, mfaz <dbl>, flag_mfaz <dbl>,
#> #   age_days <dbl>

## When age is not available ----
mw_wrangle_muac(
  df = anthro.02,
  sex = sex,
  age = NULL,
  muac = muac,
  .recode_sex = TRUE,
  .recode_muac = TRUE,
  .to = "cm",
  .decimals = 3
)
#> # A tibble: 2,267 × 15
#>    province strata cluster   sex   age weight height edema  muac wtfactor   wfhz
#>    <chr>    <chr>    <int> <dbl> <dbl>  <dbl>  <dbl> <chr> <dbl>    <dbl>  <dbl>
#>  1 Zambezia Rural      391     2  6.01    8.2   68   n       152     825.  0.349
#>  2 Zambezia Rural      404     2  6.01    7.1   65.1 n       139     287. -0.006
#>  3 Zambezia Rural      399     2  6.11    7.6   64.1 n       155     130.  0.9  
#>  4 Zambezia Urban      430     2  6.14    7.9   65.9 n       148    1277.  0.876
#>  5 Zambezia Urban      468     2  6.28    6.6   59.7 n       132     792.  1.38 
#>  6 Zambezia Urban      517     2  6.34    6     61.8 n       129     480. -0.583
#>  7 Zambezia Urban      461     2  6.34    6.5   64.4 n       123     977. -0.732
#>  8 Zambezia Rural      382     2  6.41    6.5   63.4 n       126     165. -0.349
#>  9 Zambezia Urban      502     2  6.41    7.5   66   n       142    1083. -0.006
#> 10 Zambezia Urban      500     2  6.41    6.8   64.1 n       135     972. -0.441
#> # ℹ 2,257 more rows
#> # ℹ 4 more variables: flag_wfhz <dbl>, mfaz <dbl>, flag_mfaz <dbl>,
#> #   flag_muac <dbl>