Skip to contents

The prevalence is calculated in accordance with the complex sample design properties inherent to surveys. This includes weighting the survey data where applicable and applying PROBIT method estimation (for WFHZ) when the standard deviation is problematic. This is as in the SMART Methodology.

Usage

compute_mfaz_prevalence(df, .wt = NULL, .edema = NULL, .summary_by = NULL)

compute_muac_prevalence(df, .wt = NULL, .edema = NULL, .summary_by = NULL)

compute_wfhz_prevalence(df, .wt = NULL, .edema = NULL, .summary_by = NULL)

Arguments

df

An already wrangled dataset object of class data.frame to use.

.wt

A vector of class double of the final survey weights. Default is NULL assuming a self weighted survey, as in the ENA for SMART software; otherwise, when a vector of weights if supplied, weighted analysis is computed.

.edema

A vector of class character of edema. Code should be "y" for presence and "n" for absence of bilateral edema. Default is NULL.

.summary_by

A vector of class character of the geographical areas where the data was collected and for which the analysis should be performed.

Value

A summarised table of class data.frame of the descriptive statistics about wasting.

Examples


## An example of application of `compute_muac_prevalence()` ----

### When .summary.by = NULL ----

x <- compute_muac_prevalence(
df = anthro.04,
.wt = NULL,
.edema = edema,
.summary_by = NULL
)

print(x)
#> # A tibble: 1 × 3
#>    sam_p  mam_p gam_p
#>    <dbl>  <dbl> <dbl>
#> 1 0.0212 0.0889 0.110

### When .summary_by is not set to NULL ----

p <- compute_muac_prevalence(
df = anthro.04,
.wt = NULL,
.edema = edema,
.summary_by = province
)

print(p)
#> # 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   135  0.104    0.0778     0.130        Inf    19  0.0133   0.00682
#> 2 Province 2    NA  0.112   NA         NA             NA    NA  0.0201  NA      
#> 3 Province 3    NA NA       NA         NA             NA    NA NA       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>

## An example of application of `compute_wfhz_prevalence()` ----

### When .summary_by = NULL ----
anthro.03 |>
mw_wrangle_wfhz(
sex = sex,
weight = weight,
height = height,
.recode_sex = TRUE
) |>
compute_wfhz_prevalence(
.wt = NULL,
.edema = edema,
.summary_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    82 0.0768    0.0571    0.0964        Inf    20 0.00973   0.00351    0.0160
#> # ℹ 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 .summary_by is not set to NULL ----

anthro.03 |>
mw_wrangle_wfhz(
sex = sex,
weight = weight,
height = height,
.recode_sex = TRUE
) |>
compute_wfhz_prevalence(
.wt = NULL,
.edema = edema,
.summary_by = district
)
#> ================================================================================
#> # A tibble: 4 × 17
#>   district   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 Metuge        NA 0.0251   NA        NA              NA    NA 0.00155  NA      
#> 2 Cahora-Ba…    25 0.0738    0.0348    0.113         Inf     4 0.00336  -0.00348
#> 3 Chiuta        11 0.0444    0.0129    0.0759        Inf     2 0.00444  -0.00466
#> 4 Maravia       NA 0.0450   NA        NA              NA    NA 0.00351  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>

### When a weighted analysis is needed ----

anthro.02 |>
compute_wfhz_prevalence(
.wt = "wtfactor",
.edema = edema,
.summary_by = province
)
#> # A tibble: 2 × 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 Zambezia    41 0.0261    0.0161    0.0361       1.16    10 0.00236 -0.000255
#> 2 Nampula     80 0.0595    0.0410    0.0779       1.52    33 0.0129   0.00272 
#> # ℹ 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>