-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
228 lines (154 loc) · 10.2 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{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 <img src="man/figures/logo.png" width="200px" align="right" />
<!-- badges: start -->
[](https://www.repostatus.org/#active)
[](https://www.tidyverse.org/lifecycle/#experimental)
[](https://github.com/nutriverse/sleacr/actions/workflows/R-CMD-check.yaml)
[](https://github.com/nutriverse/sleacr/actions/workflows/test-coverage.yaml)
[](https://app.codecov.io/gh/nutriverse/sleacr?branch=main)
[](https://www.codefactor.io/repository/github/nutriverse/sleacr)
[](https://zenodo.org/badge/latestdoi/186984529)
<!-- badges: end -->
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.