Title: | Simplified Lot Quality Assurance Sampling Evaluation of Access and Coverage (SLEAC) Tools in R |
---|---|
Description: | 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: | Ernest Guevarra [aut, cre] |
Maintainer: | Ernest Guevarra <[email protected]> |
License: | GPL-3 |
Version: | 0.0.0.9000 |
Built: | 2024-10-29 16:18:30 UTC |
Source: | https://github.com/nutriverse/sleacr |
Classify coverage results
classify_coverage(n_in, n_total, standard = c(0.2, 0.5))
classify_coverage(n_in, n_total, standard = c(0.2, 0.5))
n_in |
Number (integer) of cases found in the programme |
n_total |
Number (integer) of children under 5 years sampled |
standard |
Decision rule standard/s. Should be between 0 and 1. At least one standard should be provided for a two-tier coverage classifier. Two standards should be provided for a three-tier coverage classifier. Default is a three-tier classifier with rule set at 0.2 and 0.5. |
A character value or vector indicating coverage classification. If
standard
is a single value, returns "Satisfactory" if coverage is
above standard
and "Not satisfactory" if coverage is below or
equal to standard
. If standard
is two values, returns "Low" if
coverage is below or equal to lower standard, "High" if coverage is
above the higher standard, and "Moderate" for all other coverage
values.
Ernest Guevarra
classify_coverage(n_in = 6, n_total = 40) with(survey_data, classify_coverage(n_in = in_cases, n_total = n) )
classify_coverage(n_in = 6, n_total = 40) with(survey_data, classify_coverage(n_in = in_cases, n_total = n) )
Calculate the binomial coefficient "n-choose-k"
get_binom_hypergeom(n, k)
get_binom_hypergeom(n, k)
n |
Total population |
k |
Number of sample drawn from total population |
A numeric vector of binomial probability
get_binom_hypergeom(n = 600, k = 40)
get_binom_hypergeom(n = 600, k = 40)
Function to produce misclassification probabilities
get_class_prob(x)
get_class_prob(x)
x |
Simulated results data produced by |
A list of LQAS misclassification probabilities results
sim <- test_lqas_classifier(replicates = 5, runs = 5, pop = 10000, n = 40, d.lower = 60, d.upper = 90) get_class_prob(x = sim)
sim <- test_lqas_classifier(replicates = 5, runs = 5, pop = 10000, n = 40, d.lower = 60, d.upper = 90) get_class_prob(x = sim)
Calculate decision rule for a specified sample size and lower and upper triage thresholds
get_d(N, n, dLower, dUpper, alpha = 0.1, beta = 0.1)
get_d(N, n, dLower, dUpper, alpha = 0.1, beta = 0.1)
N |
Total population size of cases in the specified survey area |
n |
Sample size |
dLower |
Lower triage threshold. Values from 0 to 1. |
dUpper |
Upper triage threshold. Values from 0 to 1. |
alpha |
Maximum tolerable alpha error. Values from 0 to 1. Default is 0.1 |
beta |
Maximum tolerable beta error. Values from 0 to 1. Default is 0.1 |
A list of values providing the LQAS sampling plan for the specified parameters. The list includes sample size, decision rule, alpha error and beta error for the specified classification scheme
get_d(N = 600, n = 40, dLower = 0.7, dUpper = 0.9)
get_d(N = 600, n = 40, dLower = 0.7, dUpper = 0.9)
Calculate hypergeometric probability
get_hypergeom(k, m, n, N)
get_hypergeom(k, m, n, N)
k |
Number of cases in the sample |
m |
Number of cases in the population |
n |
Sample size |
N |
Population size |
A numeric value of hypergeometric probability given specified parameters
get_hypergeom(k = 5, m = 600, n = 25, N = 10000)
get_hypergeom(k = 5, m = 600, n = 25, N = 10000)
Calculate cumulative hypergeometric probabilities
get_hypergeom_cumulative(k, m, n, N, tail = "lower")
get_hypergeom_cumulative(k, m, n, N, tail = "lower")
k |
Number of cases in the sample |
m |
Number of cases in the population |
n |
Sample size |
N |
Population size |
tail |
A character vector indicating "lower" (default) or "upper" tail |
get_hypergeom_cumulative(k = 5, m = 600, n = 25, N = 10000)
get_hypergeom_cumulative(k = 5, m = 600, n = 25, N = 10000)
Calculate sample size of number of cases to be found to assess coverage
get_n(N, dLower, dUpper, alpha = 0.1, beta = 0.1)
get_n(N, dLower, dUpper, alpha = 0.1, beta = 0.1)
N |
Total population size of cases in the specified survey area |
dLower |
Lower triage threshold. Values from 0 to 1. |
dUpper |
Upper triage threshold. Values from 0 to 1. |
alpha |
Maximum tolerable alpha error. Values from 0 to 1. Default is 0.1 |
beta |
Maximum tolerable beta error. Values from 0 to 1. Default is 0.1 |
A list of values providing the LQAS sampling plan for the specified parameters. The list includes sample size, decision rule, alpha error and beta error for the specified classification scheme
get_n(N = 600, dLower = 0.7, dUpper = 0.9)
get_n(N = 600, dLower = 0.7, dUpper = 0.9)
Calculate estimated number of cases for a condition affecting children under 5 years old in a specified survey area
get_n_cases(N, u5, p)
get_n_cases(N, u5, p)
N |
Population for all ages in the specified survey area |
u5 |
Proportion (value from 0 to 1) of population that are aged 6-59 months |
p |
Prevalence of condition that is to be assessed |
Numeric value of the estimated number of cases in the specified survey area
## Calculate number of SAM cases in a population of 100000 persons of all ## ages with an under-5 population of 17% and a prevalence of 2% get_n_cases(N = 100000, u5 = 0.17, p = 0.02)
## Calculate number of SAM cases in a population of 100000 persons of all ## ages with an under-5 population of 17% and a prevalence of 2% get_n_cases(N = 100000, u5 = 0.17, p = 0.02)
Calculate number of clusters to sample to reach target sample size
get_n_clusters(n, N, u5, p)
get_n_clusters(n, N, u5, p)
n |
Target sample size of cases for the coverage survey |
N |
Average cluster population for all ages in the specified survey area |
u5 |
Proportion (value from 0 to 1) of population that are aged 6-59 months |
p |
Prevalence of condition that is to be assessed |
Numeric value of the estimated number of clusters to sample to reach target sample size
## Calculate number of villages to sample given an average village population ## of 600 persons of all ages with an under-5 population of 17% and a ## prevalence of SAM of 2% if the target sample size is 40 get_n_clusters(n = 40, N = 600, u5 = 0.17, p = 0.02)
## Calculate number of villages to sample given an average village population ## of 600 persons of all ages with an under-5 population of 17% and a ## prevalence of SAM of 2% if the target sample size is 40 get_n_clusters(n = 40, N = 600, u5 = 0.17, p = 0.02)
Select sampling clusters using systematic sampling
get_sampling_interval(N_clusters, n_clusters) select_random_start(interval) select_sampling_clusters(N_clusters, n_clusters) create_sampling_list(cluster_list, n_clusters)
get_sampling_interval(N_clusters, n_clusters) select_random_start(interval) select_sampling_clusters(N_clusters, n_clusters) create_sampling_list(cluster_list, n_clusters)
N_clusters |
Total number of clusters in survey area |
n_clusters |
Number of sampling clusters to be selected |
interval |
Sampling interval usually calculated using
|
cluster_list |
A data.frame containing at least the name or any other identifier for the entire set of clusters to sample from. |
A numeric value for get_sampling_interval()
and
select_random_start()
; An integer vector for select_sampling_clusters()
giving the row index for selected clusters; A data.frame for
create_sampling_list()
which is a subset of cluster_list
get_sampling_interval(N_clusters = 211, n_clusters = 35) interval <- get_sampling_interval(N_clusters = 211, n_clusters = 35) select_random_start(interval) select_sampling_clusters(N_clusters = 211, n_clusters = 35) create_sampling_list(cluster_list = village_list, n_clusters = 70)
get_sampling_interval(N_clusters = 211, n_clusters = 35) interval <- get_sampling_interval(N_clusters = 211, n_clusters = 35) select_random_start(interval) select_sampling_clusters(N_clusters = 211, n_clusters = 35) create_sampling_list(cluster_list = village_list, n_clusters = 70)
Function to simulate survey data of covered/cases and non-covered/non-cases given specified parameters
make_data(proportion, pop)
make_data(proportion, pop)
proportion |
A numeric value of a coverage proportion to simulate on |
pop |
Population size from which simulated coverage survey data is to be taken from |
A numeric vector of cases and non-cases (1s and 0s)
make_data(proportion = 0.3, pop = 10000)
make_data(proportion = 0.3, pop = 10000)
plot
helper function for test_lqas_classifier()
functionplot
helper function for test_lqas_classifier()
function
## S3 method for class 'lqasSim' plot(x, ...)
## S3 method for class 'lqasSim' plot(x, ...)
x |
An object of class |
... |
Additional |
An LQAS probability of classification plot
x <- test_lqas_classifier(replicates = 5, runs = 5, pop = 10000, n = 40, d.lower = 60, d.upper = 90) plot(x)
x <- test_lqas_classifier(replicates = 5, runs = 5, pop = 10000, n = 40, d.lower = 60, d.upper = 90) plot(x)
print
helper function for get_class_prob()
functionprint
helper function for get_class_prob()
function
## S3 method for class 'lqasClass' print(x, ...)
## S3 method for class 'lqasClass' print(x, ...)
x |
An object resulting from applying the |
... |
Additional |
Printed output of get_class_prob()
function
sim <- test_lqas_classifier(replicates = 5, runs = 5, pop = 10000, n = 40, d.lower = 60, d.upper = 90) x <- get_class_prob(x = sim) print(x)
sim <- test_lqas_classifier(replicates = 5, runs = 5, pop = 10000, n = 40, d.lower = 60, d.upper = 90) x <- get_class_prob(x = sim) print(x)
Function to perform LQAS based on data based on specified decision rules
run_lqas(data, n, d.lower, d.upper)
run_lqas(data, n, d.lower, d.upper)
data |
A vector of simulated data produced by |
n |
Sample size of actual or test coverage data |
d.lower |
A numeric value for the lower classification threshold |
d.upper |
A numeric value for the upper classification threshold |
A list of coverage proportions and LQAS outcomes
run_lqas(data = make_data(proportion = 0.3, pop = 10000), n = 40, d.lower = 60, d.upper = 90)
run_lqas(data = make_data(proportion = 0.3, pop = 10000), n = 40, d.lower = 60, d.upper = 90)
Function to perform a series of LQAS analysis on simulated coverage survey data
simulate_lqas( runs = 50, pop = NULL, n, d.lower, d.upper, p.lower = 0, p.upper = 100, fine = 1, progress = TRUE )
simulate_lqas( runs = 50, pop = NULL, n, d.lower, d.upper, p.lower = 0, p.upper = 100, fine = 1, progress = TRUE )
runs |
Number of simulation runs to perform per coverage proportion. Default is 50 runs |
pop |
Population size from which simulated coverage survey data is to be taken from |
n |
Sample size of actual or test coverage data |
d.lower |
A numeric value for the lower classification threshold |
d.upper |
A numeric value for the upper classification threshold |
p.lower |
Starting proportion for simulations. Default is 0 |
p.upper |
Ending proportion for simulations. Default is 100 |
fine |
Granularity of simulated proportions; Default to 1 |
progress |
Logical. Should simulation progress be shown? Default is TRUE |
A data.frame of coverage proportions and LQAS outcomes
simulate_lqas(runs = 10, pop = 10000, n = 40, d.lower = 60, d.upper = 90)
simulate_lqas(runs = 10, pop = 10000, n = 40, d.lower = 60, d.upper = 90)
SLEAC survey data from Sierra Leone
survey_data
survey_data
A tibble with 14 rows and 6 columns:
country
Country
province
Province
district
District
in_cases
Cases found who are in the programme
out_cases
Cases found who are not in the programme
n
Total number of under 5 children sampled
Ministry of Health, Sierra Leone
survey_data
survey_data
Function to test performance of LQAS classifier
test_lqas_classifier( replicates = 20, runs = 50, pop = NULL, n = NULL, d.lower = NULL, d.upper = NULL, p.lower = 0, p.upper = 100, fine = 1, progress = TRUE )
test_lqas_classifier( replicates = 20, runs = 50, pop = NULL, n = NULL, d.lower = NULL, d.upper = NULL, p.lower = 0, p.upper = 100, fine = 1, progress = TRUE )
replicates |
Number of replicate LQAS simulations to perform. Default is set to 20 replicates |
runs |
Number of simulation runs to perform per coverage proportion. Default is 50 runs |
pop |
Population size from which simulated coverage survey data is to be taken from |
n |
Sample size of actual or test coverage data |
d.lower |
A numeric value for the lower classification threshold |
d.upper |
A numeric value for the upper classification threshold |
p.lower |
Starting proportion for simulations. Default is 0 |
p.upper |
Ending proportion for simulations. Default is 100 |
fine |
Granularity of simulated proportions; Defaul to 1 |
progress |
Logical. Should simulation progress be shown? Default is TRUE |
A sleac object
test_lqas_classifier(replicates = 5, runs = 5, pop = 10000, n = 40, d.lower = 60, d.upper = 90)
test_lqas_classifier(replicates = 5, runs = 5, pop = 10000, n = 40, d.lower = 60, d.upper = 90)
List of villages in Bo District, Sierra Leone
village_list
village_list
A tibble with 1001 rows and 4 columns:
id
Unique identifier
chiefdom
Chiefdom
section
Section
village
Village
Ministry of Health, Sierra Leone
village_list
village_list