sleacr

Simplified Lot Quality Assurance Sampling Evaluation of Access and Coverage (SLEAC) Tools

https://github.com/nutriverse/sleacr

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.3%) to scientific vocabulary

Keywords

acute-malnutrition cmam coverage nutrition rstats sleac wasting
Last synced: 6 months ago · JSON representation ·

Repository

Simplified Lot Quality Assurance Sampling Evaluation of Access and Coverage (SLEAC) Tools

Basic Info
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 8
  • Releases: 1
Topics
acute-malnutrition cmam coverage nutrition rstats sleac wasting
Created almost 7 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog Contributing Funding License Code of conduct Citation

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

set.seed(1972)

library(sleacr)
library(tibble)
```

# sleacr: Simplified Lot Quality Assurance Sampling Evaluation of Access and Coverage (SLEAC) Tools 


[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![R-CMD-check](https://github.com/nutriverse/sleacr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nutriverse/sleacr/actions/workflows/R-CMD-check.yaml)
[![test-coverage](https://github.com/nutriverse/sleacr/actions/workflows/test-coverage.yaml/badge.svg)](https://github.com/nutriverse/sleacr/actions/workflows/test-coverage.yaml)
[![Codecov test coverage](https://codecov.io/gh/nutriverse/sleacr/branch/main/graph/badge.svg)](https://app.codecov.io/gh/nutriverse/sleacr?branch=main)
[![CodeFactor](https://www.codefactor.io/repository/github/nutriverse/sleacr/badge)](https://www.codefactor.io/repository/github/nutriverse/sleacr)
[![DOI](https://zenodo.org/badge/186984529.svg)](https://zenodo.org/badge/latestdoi/186984529)


In the recent past, measurement of coverage has been mainly through two-stage cluster sampled surveys either as part of a nutrition assessment or through a specific coverage survey known as Centric Systematic Area Sampling (CSAS). However, such methods are resource intensive and often only used for final programme evaluation meaning results arrive too late for programme adaptation. SLEAC, which stands for Simplified Lot Quality Assurance Sampling Evaluation of Access and Coverage, is a low resource method designed specifically to address this limitation and is used regularly for monitoring, planning and importantly, timely improvement to programme quality, both for agency and Ministry of Health (MoH) led programmes. This package provides functions for use in conducting a SLEAC assessment.

## What does the package do?

The `{sleacr}` package provides functions that facilitate the design, sampling, data collection, and data analysis of a SLEAC survey. The current version of the `{sleacr}` package currently provides the following:

* Functions to calculate the sample size needed for a SLEAC survey;

* Functions to draw a stage 1 sample for a SLEAC survey;

* Functions to classify coverage;

* Functions to determine the performance of chosen classifier cut-offs for analysis of SLEAC survey data;

* Functions to estimate coverage over wide areas; and,

* Functions to test for coverage homogeneity across multiple surveys over wide areas.

## Installation

The `{sleacr}` package is not yet available on [CRAN](https://cran.r-project.org) but can be installed from the [nutriverse R Universe](https://nutriverse.r-universe.dev) as follows:

```{r install, echo = TRUE, eval = FALSE}
install.packages(
  "sleacr",
  repos = c('https://nutriverse.r-universe.dev', 'https://cloud.r-project.org')
)
```

## Usage

### Lot quality assurance sampling frame

To setup an LQAS sampling frame, a target sample size is first estimated. For example, if the survey area has an estimated population of about 600 severe acute malnourished (SAM) children and you want to assess whether coverage is reaching at least 50%, the sample size can be calculated as follows:

```{r samp-size-1, eval = FALSE}
get_sample_n(N = 600, dLower = 0.5, dUpper = 0.8)
```

which gives an LQAS sampling plan list with values for the target minimum sample size (`n`), the decision rule (`d`), the observed alpha error (`alpha`), and the observed beta error (`beta`).

```{r samp-size-1-show, echo = FALSE}
get_sample_n(N = 600, dLower = 0.5, dUpper = 0.8)
```

In this sampling plan, a target minimum sample size of 19 SAM cases should be aimed for with a decision rule of more than 12 SAM cases covered to determine whether programme coverage is at least 50% with alpha and beta errors no more than 10%. The alpha and beta errors requirement is set at no more than 10% by default. This can be made more precise by setting alpha and beta errors less than 10%.

There are contexts where survey data has already been collected and the sample is less than what was aimed for based on the original sampling frame. The `get_sample_d()` function is used to determine the error levels of the achieved sample size. For example, if the survey described above only achieved a sample size of 16, the `get_sample_d()` function can be used as follows:

```{r samp-size-2, eval = FALSE}
get_sample_d(N = 600, n = 16, dLower = 0.5, dUpper = 0.8)
```

which gives an alternative LQAS sampling plan based on the achieved sample size.

```{r samp-size-2-show, echo = FALSE}
get_sample_d(N = 600, n = 16, dLower = 0.5, dUpper = 0.8)
```

In this updated sampling plan, the decision rule is now more than 10 SAM cases but with higher alpha and beta errors. Note that the beta error is now slightly higher than 10%.

### Stage 1 sample

The first stage sample of a SLEAC survey is a systematic spatial sample. Two methods can be used and both methods take the sample from all parts of the survey area: the *list-based* method and the *map-based* method. The `{sleacr}` package currently supports the implementation of the *list-based* method.

In the list-based method, communities to be sampled are selected systematically from a complete list of communities in the survey area. This list of communities should sorted by one or more non-overlapping spatial factors such as district and subdistricts within districts. The `village_list` dataset is an example of such a list.

```{r}
village_list
```

The `get_sampling_list()` function implements the list-based sampling method. For example, if 40 clusters/villages are needed to be sampled to find the 19 SAM cases calculated earlier, a sampling list can be created as follows:

```{r stage-1-sample, eval = FALSE}
get_sampling_list(village_list, 40)
```

which provides the following sampling list:

```{r stage-1-sample-show, echo = FALSE}
get_sampling_list(village_list, 40) |>
  knitr::kable()
```

### Classifying coverage

With data collected from a SLEAC survey, the `lqas_classify_coverage()` function is used to classify coverage. The `{sleacr}` package comes with the `survey_data` dataset from a national SLEAC survey conducted in Sierra Leone.

```{r survey-data}
survey_data
```

Using this dataset, per district coverage classifications can be calculated as follows:

```{r classify-coverage, eval = FALSE}
with(
  survey_data, 
  lqas_classify(
    cases_in = cases_in, cases_out = cases_out, rec_in = rec_in
  )
)
```

which outputs the following results:

```{r classify-coverage-show, echo = FALSE}
with(
  survey_data, 
  lqas_classify(
    cases_in = cases_in, cases_out = cases_out, rec_in = rec_in
  )
)
```

The function provides estimates for *case-finding effectiveness* and for *treatment coverage* as a `data.frame` object.

### Assessing classifier performance

It is useful to be able to assess the performance of the classifier chosen for a SLEAC survey. For example, in the context presented above of an area with a population of 600, a sample size of 40 and a 60% and 90% threshold classifier, the performance of this classifier can be assessed by first simulating a population and then determining the classification probabilities of the chosen classifier on this population.

```{r classifier-test}
## Simulate population ----
lqas_sim_pop <- lqas_simulate_test(
  pop = 600, n = 40, dLower = 0.6, dUpper = 0.9
)

## Get classification probabilities ----
lqas_get_class_prob(lqas_sim_pop)
```

This diagnostic test can also be plotted.

```{r classifier-test-plot}
plot(lqas_sim_pop)
```

### Estimating coverage over wide areas

When SLEAC is implemented in several service delivery units, it is also possible to estimate an overall coverage across these service delivery units. For example, using the `survey_data` dataset from a national SLEAC survey conducted in Sierra Leone, an overall coverage estimate can be calculated. For this, additional information on the total population for each service delivery unit surveyed will be needed. For the Sierra Leone example, the `pop_data` dataset gives the population for each district in Sierra Leone.

```{r pop-data}
pop_data
```

The overall coverage estimate can be calculated as follows:

```{r overall-coverage, eval = FALSE}
pop_df <- pop_data |>
  setNames(nm = c("strata", "pop"))

estimate_coverage_overall(
  survey_data, pop_data, strata = "district", u5 = 0.177, p = 0.01
)
```

which gives the following results:

```{r overall-coverage-show, echo = FALSE}
pop_df <- pop_data |>
  setNames(nm = c("strata", "pop"))

estimate_coverage_overall(
  survey_data, pop_df, strata = "district", u5 = 0.177, p = 0.01
)
```

### Testing coverage homogeneity

When estimating coverage across multiple surveys over wide areas, it is good practice to assess whether coverage across each of the service delivery units is homogenous. The function `check_coverage_homogeneity()` is used for this purpose:

```{r check-homogeneity, eval = FALSE}
check_coverage_homogeneity(survey_data)
```

which results in the following output:

```{r check-homogeneity-show, echo = FALSE}
check_coverage_homogeneity(survey_data)
```

In this example, case-finding effectiveness is homogeneous while treatment coverage is patchy.

## Citation

If you use `{sleacr}` in your work, please cite using the suggested citation provided by a call to the `citation` function as follows:

```{r cite}
citation("sleacr")
```

## Community guidelines

Feedback, bug reports, and feature requests are welcome; file issues or seek support [here](https://github.com/nutriverse/sleacr/issues). If you would like to contribute to the package, please see our [contributing guidelines](https://nutriverse.io/sleacr/CONTRIBUTING.html).

This project is released with a [Contributor Code of Conduct](https://nutriverse.io/sleacr/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.

Owner

  • Name: nutriverse
  • Login: nutriverse
  • Kind: organization
  • Location: Oxford, United Kingdom

Citation (CITATION.cff)

# --------------------------------------------
# CITATION file created with {cffr} R package
# See also: https://docs.ropensci.org/cffr/
# --------------------------------------------
 
cff-version: 1.2.0
message: 'To cite package "sleacr" in publications use:'
type: software
license: GPL-3.0-or-later
title: 'sleacr: Simplified Lot Quality Assurance Sampling Evaluation of Access and
  Coverage (SLEAC) Tools'
version: 0.1.0.9000
abstract: In the recent past, measurement of coverage has been mainly through two-stage
  cluster sampled surveys either as part of a nutrition assessment or through a specific
  coverage survey known as Centric Systematic Area Sampling (CSAS). However, such
  methods are resource intensive and often only used for final programme evaluation
  meaning results arrive too late for programme adaptation. SLEAC, which stands for
  Simplified Lot Quality Assurance Sampling Evaluation of Access and Coverage, is
  a low resource method designed specifically to address this limitation and is used
  regularly for monitoring, planning and importantly, timely improvement to programme
  quality, both for agency and Ministry of Health (MoH) led programmes. SLEAC is designed
  to complement the Semi-quantitative Evaluation of Access and Coverage (SQUEAC) method.
  This package provides functions for use in conducting a SLEAC assessment.
authors:
- family-names: Guevarra
  given-names: Ernest
  email: ernest@guevarra.io
  orcid: https://orcid.org/0000-0002-4887-4415
- family-names: Myatt
  given-names: Mark
  email: mark@brixtonhealth.com
  orcid: https://orcid.org/0000-0003-1119-1474
preferred-citation:
  type: book
  title: Semi-Quantitative Evaluation of Access and Coverage (SQUEAC)/Simplified Lot
    Quality Assurance Sampling Evaluation of Access and Coverage (SLEAC) Technical
    Reference
  authors:
  - name: Mark Myatt
  - name: Ernest Guevarra
  - name: Lionella Fieschi
  - name: Allison Norris
  - name: Saul Guerrero
  - name: Lilly Schofield
  - name: Daniel Jones
  - name: Ephrem Emru
  - name: Kate Sadler
  year: '2012'
  publisher:
    name: FHI 360/FANTA
    address: Washington, DC
  url: https://www.fantaproject.org/sites/default/files/resources/SQUEAC-SLEAC-Technical-Reference-Oct2012_0.pdf
repository-code: https://github.com/nutriverse/sleacr
url: https://nutriverse.io/sleacr/
contact:
- family-names: Guevarra
  given-names: Ernest
  email: ernest@guevarra.io
  orcid: https://orcid.org/0000-0002-4887-4415
keywords:
- cmam
- coverage
- rstats
- sleac
references:
- type: software
  title: 'R: A Language and Environment for Statistical Computing'
  notes: Depends
  url: https://www.R-project.org/
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2025'
  version: '>= 4.1.0'
- type: software
  title: parallel
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2025'
- type: software
  title: parallelly
  abstract: 'parallelly: Enhancing the ''parallel'' Package'
  notes: Imports
  url: https://parallelly.futureverse.org
  repository: https://CRAN.R-project.org/package=parallelly
  authors:
  - family-names: Bengtsson
    given-names: Henrik
    email: henrikb@braju.com
    orcid: https://orcid.org/0000-0002-7579-5165
  year: '2025'
  doi: 10.32614/CRAN.package.parallelly
- type: software
  title: covr
  abstract: 'covr: Test Coverage for Packages'
  notes: Suggests
  url: https://covr.r-lib.org
  repository: https://CRAN.R-project.org/package=covr
  authors:
  - family-names: Hester
    given-names: Jim
    email: james.f.hester@gmail.com
  year: '2025'
  doi: 10.32614/CRAN.package.covr
- type: software
  title: knitr
  abstract: 'knitr: A General-Purpose Package for Dynamic Report Generation in R'
  notes: Suggests
  url: https://yihui.org/knitr/
  repository: https://CRAN.R-project.org/package=knitr
  authors:
  - family-names: Xie
    given-names: Yihui
    email: xie@yihui.name
    orcid: https://orcid.org/0000-0003-0645-5666
  year: '2025'
  doi: 10.32614/CRAN.package.knitr
- type: software
  title: rmarkdown
  abstract: 'rmarkdown: Dynamic Documents for R'
  notes: Suggests
  url: https://pkgs.rstudio.com/rmarkdown/
  repository: https://CRAN.R-project.org/package=rmarkdown
  authors:
  - family-names: Allaire
    given-names: JJ
    email: jj@posit.co
  - family-names: Xie
    given-names: Yihui
    email: xie@yihui.name
    orcid: https://orcid.org/0000-0003-0645-5666
  - family-names: Dervieux
    given-names: Christophe
    email: cderv@posit.co
    orcid: https://orcid.org/0000-0003-4474-2498
  - family-names: McPherson
    given-names: Jonathan
    email: jonathan@posit.co
  - family-names: Luraschi
    given-names: Javier
  - family-names: Ushey
    given-names: Kevin
    email: kevin@posit.co
  - family-names: Atkins
    given-names: Aron
    email: aron@posit.co
  - family-names: Wickham
    given-names: Hadley
    email: hadley@posit.co
  - family-names: Cheng
    given-names: Joe
    email: joe@posit.co
  - family-names: Chang
    given-names: Winston
    email: winston@posit.co
  - family-names: Iannone
    given-names: Richard
    email: rich@posit.co
    orcid: https://orcid.org/0000-0003-3925-190X
  year: '2025'
  doi: 10.32614/CRAN.package.rmarkdown
- type: software
  title: spelling
  abstract: 'spelling: Tools for Spell Checking in R'
  notes: Suggests
  url: https://ropensci.r-universe.dev/spelling
  repository: https://CRAN.R-project.org/package=spelling
  authors:
  - family-names: Ooms
    given-names: Jeroen
    email: jeroen@berkeley.edu
    orcid: https://orcid.org/0000-0002-4035-0289
  - family-names: Hester
    given-names: Jim
    email: james.hester@rstudio.com
  year: '2025'
  identifiers:
  - type: url
    value: https://docs.ropensci.org/spelling/
  doi: 10.32614/CRAN.package.spelling
- type: software
  title: testthat
  abstract: 'testthat: Unit Testing for R'
  notes: Suggests
  url: https://testthat.r-lib.org
  repository: https://CRAN.R-project.org/package=testthat
  authors:
  - family-names: Wickham
    given-names: Hadley
    email: hadley@posit.co
  year: '2025'
  doi: 10.32614/CRAN.package.testthat
  version: '>= 3.0.0'
- type: software
  title: tibble
  abstract: 'tibble: Simple Data Frames'
  notes: Suggests
  url: https://tibble.tidyverse.org/
  repository: https://CRAN.R-project.org/package=tibble
  authors:
  - family-names: Müller
    given-names: Kirill
    email: kirill@cynkra.com
    orcid: https://orcid.org/0000-0002-1416-3412
  - family-names: Wickham
    given-names: Hadley
    email: hadley@rstudio.com
  year: '2025'
  doi: 10.32614/CRAN.package.tibble

GitHub Events

Total
  • Issues event: 85
  • Delete event: 1
  • Issue comment event: 26
  • Push event: 85
  • Pull request event: 52
  • Create event: 1
Last Year
  • Issues event: 85
  • Delete event: 1
  • Issue comment event: 26
  • Push event: 85
  • Pull request event: 52
  • Create event: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 6
  • Total pull requests: 6
  • Average time to close issues: about 10 hours
  • Average time to close pull requests: 6 days
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.83
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 6
  • Pull requests: 6
  • Average time to close issues: about 10 hours
  • Average time to close pull requests: 6 days
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.83
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ernestguevarra (37)
Pull Request Authors
  • ernestguevarra (28)
Top Labels
Issue Labels
documentation (11) refactor (6) enhancement (5) bug (4) infrastructure (4) testing (2) data recode (1) feature engineering (1)
Pull Request Labels
documentation (17) refactor (7) feature engineering (4) enhancement (4) testing (3) infrastructure (3) bug (1)

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R >= 2.10 depends
  • covr * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • spelling * suggests
  • testthat >= 3.0.0 suggests
  • tibble * suggests
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.5.0 composite
  • actions/checkout v4 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/netlify.yaml actions
  • actions/checkout v4 composite
  • nwtgck/actions-netlify v3.0 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
  • r-lib/actions/setup-tinytex v2 composite