Estimate the prevalence of wasting based on z-scores of muac-for-age (MFAZ)
Source:R/prev_wasting_mfaz.R
mw_estimate_prevalence_mfaz.Rd
Calculate the prevalence estimates of wasting based on z-scores of muac-for-age and/or bilateral edema. The function allows users to get the prevalence estimates calculated in accordance with the complex sample design properties; this includes applying survey weights when needed or applicable.
Before estimating, the function evaluates the quality of data by calculating and rating the standard deviation of z-scores of MFAZ. If rated as problematic, the prevalence is estimated based on the PROBIT method.
Outliers are detected based on SMART flags and get excluded prior prevalence analysis.
Arguments
- df
A data set object of class
data.frame
to use. This must have been wrangled using this package's wrangling function for MUAC data. The function uses a variable name calledcluster
where the primary sampling unit IDs are stored. Make sure to rename your cluster ID variable tocluster
, otherwise the function will error and terminate the execution.- wt
A vector of class
double
of the final survey weights. Default isNULL
assuming a self weighted survey, as in the ENA for SMART software; otherwise, when a vector of weights if supplied, weighted analysis is done.- edema
A vector of class
character
of edema. Code should be "y" for presence and "n" for absence of bilateral edema. Default isNULL
.- .by
A vector of class
character
ornumeric
of the geographical areas or respective IDs for where the data was collected and for which the analysis should be summarized at.
Examples
## When .by = NULL ----
mw_estimate_prevalence_mfaz(
df = anthro.04,
wt = NULL,
edema = edema,
.by = NULL
)
#> # A tibble: 1 × 16
#> gam_n gam_p gam_p_low gam_p_upp gam_p_deff sam_n sam_p sam_p_low sam_p_upp
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 330 0.107 0.0873 0.127 Inf 53 0.0144 0.00894 0.0198
#> # ℹ 7 more variables: sam_p_deff <dbl>, mam_n <dbl>, mam_p <dbl>,
#> # mam_p_low <dbl>, mam_p_upp <dbl>, mam_p_deff <dbl>, wt_pop <dbl>
## When .by is not set to NULL ----
mw_estimate_prevalence_mfaz(
df = anthro.04,
wt = NULL,
edema = edema,
.by = province
)
#> # A tibble: 3 × 17
#> province gam_n gam_p gam_p_low gam_p_upp gam_p_deff sam_n sam_p sam_p_low
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Province 1 154 0.119 0.0851 0.153 Inf 15 0.0102 0.00132
#> 2 Province 2 98 0.0854 0.0565 0.114 Inf 16 0.0117 0.00510
#> 3 Province 3 NA 0.257 NA NA NA NA 0.0491 NA
#> # ℹ 8 more variables: sam_p_upp <dbl>, sam_p_deff <dbl>, mam_n <dbl>,
#> # mam_p <dbl>, mam_p_low <dbl>, mam_p_upp <dbl>, mam_p_deff <dbl>,
#> # wt_pop <dbl>