Title: | Sample Size Calculation in Reversible Catalytic Models |
---|---|
Description: | Sample size and confidence interval calculations in reversible catalytic models, with applications in malaria research. Further details can be found in the paper by Sepúlveda and Drakeley (2015, <doi:10.1186/s12936-015-0661-z>). |
Authors: | Márcia Graça [aut, cre, cph] |
Maintainer: | Márcia Graça <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.0 |
Built: | 2024-12-07 15:28:46 UTC |
Source: | https://github.com/marciagraca/rcmsize |
Calculates the confidence interval for the seroconversion rate (SCR) using the confidence interval of seroprevalence.
IC_SCR(SP_interval, SRR, ages, A_max, limits = c(0, 1))
IC_SCR(SP_interval, SRR, ages, A_max, limits = c(0, 1))
SP_interval |
A vector with the lower and upper limits of seroprevalence. |
SRR |
Seroreversion rate. |
ages |
Vector with the proportions of different ages in the population (age structure). |
A_max |
Maximum age considered in the population. |
limits |
Lower and upper limits for the calculation of |
A vector with the lower and upper limits for the seroconversion rate SCR
.
A_max <- 80 age_distribution <- rep(1 / A_max, A_max) IC_SCR(c(0.1, 0.2), 0.01, age_distribution, A_max, limits = c(0, 1))
A_max <- 80 age_distribution <- rep(1 / A_max, A_max) IC_SCR(c(0.1, 0.2), 0.01, age_distribution, A_max, limits = c(0, 1))
Calculates the confidence interval for a seroprevalence estimate with a specified confidence level.
IC_SP(SP, n, conf.level = 0.95, method = "asymptotic")
IC_SP(SP, n, conf.level = 0.95, method = "asymptotic")
SP |
Seroprevalence estimate. |
n |
Sample size. |
conf.level |
Confidence level (default is 0.95). |
method |
Method for calculating the confidence interval (default is "asymptotic"). Available methods: c("asymptotic","exact","ac","wilson","logit","cloglog") |
A vector with the lower and upper limits of the confidence interval.
The methods available in this function are some of the available in the binom package. For more information, see https://CRAN.R-project.org/package=binom
IC_SP(0.25, 100, conf.level = 0.95, method = "asymptotic")
IC_SP(0.25, 100, conf.level = 0.95, method = "asymptotic")
Calculates the confidence interval for seroprevalence using the Wald method with continuity correction.
IC_SP_Waldcc(SP, n, conf.level = 0.95)
IC_SP_Waldcc(SP, n, conf.level = 0.95)
SP |
Seroprevalence estimate. |
n |
Sample size. |
conf.level |
Confidence level (default is 0.95). |
A vector with the lower and upper limits of the confidence interval.
IC_SP_Waldcc(0.25, 100, conf.level = 0.95)
IC_SP_Waldcc(0.25, 100, conf.level = 0.95)
This function calculates the probability of seropositivity based on the age and the seroconversion and seroreversion rates, using a reversible catalytic model.
prob_seropositive(SCR, SRR, t)
prob_seropositive(SCR, SRR, t)
SCR |
Seroconversion Rate |
SRR |
Seroreversion Rate. |
t |
Age for which we want to calculate the probability of seropositivity. |
The probability of seropositivity for age 't'.
For more information on the reversible catalytic model, see https://link.springer.com/article/10.1186/s12936-015-0661-z
prob_seropositive(0.03, 0.01, 45)
prob_seropositive(0.03, 0.01, 45)
Estimates the required sample size so that the confidence interval width for SCR does not exceed a specified limit.
sample_s( SCR, RL, SRR, ages, A_max, limits, max_iter = 10000, conf.level = 0.95, method = "asymptotic" )
sample_s( SCR, RL, SRR, ages, A_max, limits, max_iter = 10000, conf.level = 0.95, method = "asymptotic" )
SCR |
Seroconversion rate. |
RL |
Desired relative width. |
SRR |
Seroreversion rate. |
ages |
Vector with the proportions of different ages in the population (age structure). |
A_max |
Maximum age considered in the population. |
limits |
Lower and upper limits for the calculation of |
max_iter |
Maximum number of iterations. |
conf.level |
Confidence level (default is 0.95). |
method |
Method for calculating the confidence interval. Available methods: "waldcc" and the methods in IC_SP documentation. |
**Disclaimer**: The sample size function may not produce accurate values for scenarios involving extremely low SCR (e.g., elimination scenarios). Users are advised to exercise caution and consider the results critically when applying this function to such cases.
A list with the required sample size, the confidence interval for
seroprevalence, and the confidence interval for SCR
.
A_max <- 80 age_distribution <- rep(1 / A_max, A_max) sample_s(0.03, 1, 0.01, age_distribution, A_max, limits = c(0, 1))
A_max <- 80 age_distribution <- rep(1 / A_max, A_max) sample_s(0.03, 1, 0.01, age_distribution, A_max, limits = c(0, 1))
Calculates the seroprevalence considering an age distribution and a reversible catalytic model.
seroprevalence(ages, A_max, SCR, SRR)
seroprevalence(ages, A_max, SCR, SRR)
ages |
Vector with the proportions of different ages in the population (age structure). |
A_max |
Maximum age considered in the population. |
SCR |
Seroconversion rate. |
SRR |
Seroreversion rate. |
The total seroprevalence weighted by the age distribution.
A_max <- 80 age_distribution <- rep(1 / A_max, A_max) seroprevalence(age_distribution, A_max, 0.03, 0.01)
A_max <- 80 age_distribution <- rep(1 / A_max, A_max) seroprevalence(age_distribution, A_max, 0.03, 0.01)