Identify outlier z-scores for weight-for-height (WFHZ) and MUAC-for-age (MFAZ) following the SMART methodology. The function can also be used to detect outliers for height-for-age (HFAZ) and weight-for-age (WFAZ) z-scores following the same approach.
For raw MUAC values, outliers constitute values that are less than 100 millimeters or greater than 200 millimeters.
Removing outliers consist in setting the outlier record to NA
and not necessarily
to delete it from the data set. This is useful in the analysis procedures
where outliers must be removed, such as the analysis of the standard deviation.
Arguments
- x
A vector of class
numeric
of WFHZ, MFAZ, HFAZ, WFAZ or raw MUAC values. The latter should be in millimeters. If the class is different than expected, the function will stop execution and return an error message indicating the type of mismatch.- .from
A choice between
zscores
andraw_muac
for where outliers should be detected and flagged from.
Value
A vector of the same length as x
for flagged records coded as
1
for is a flag and 0
not a flag.
Details
For z-score-based detection, flagged records represent outliers that deviate substantially from the sample's z-score mean, making them unlikely to reflect accurate measurements. For raw MUAC values, flagged records are those that fall outside the acceptable fixed range. Including such outliers in the analysis could compromise the accuracy and precision of the resulting estimates.
The flagging criterion used for raw MUAC values is based on a recommendation by Bilukha, O., & Kianian, B. (2023).
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. Available at 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
## Sample data of raw MUAC values ----
x <- anthro.01$muac
## Apply the function with `.from` set to "raw_muac" ----
m <- flag_outliers(x, .from = "raw_muac")
head(m)
#> [1] 0 0 0 0 0 0
## Sample data of z-scores (be it WFHZ, MFAZ, HFAZ or WFAZ) ----
x <- anthro.02$mfaz
# Apply the function with `.from` set to "zscores" ----
z <- flag_outliers(x, .from = "zscores")
tail(z)
#> [1] 0 0 0 0 0 0
## With `.from` set to "zscores" ----
z <- remove_flags(
x = wfhz.01$wfhz,
.from = "zscores"
)
head(z)
#> [1] 1.833 0.278 -0.123 1.442 0.652 0.469
## With `.from` set to "raw_muac" ----
m <- remove_flags(
x = mfaz.01$muac,
.from = "raw_muac"
)
tail(m)
#> [1] 146 143 138 153 158 147