Package 'RCMsize'

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

Help Index


Confidence Interval for the Seroconversion Rate (SCR)

Description

Calculates the confidence interval for the seroconversion rate (SCR) using the confidence interval of seroprevalence.

Usage

IC_SCR(SP_interval, SRR, ages, A_max, limits = c(0, 1))

Arguments

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 SCR.

Value

A vector with the lower and upper limits for the seroconversion rate SCR.

Examples

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))

Confidence Interval for Seroprevalence

Description

Calculates the confidence interval for a seroprevalence estimate with a specified confidence level.

Usage

IC_SP(SP, n, conf.level = 0.95, method = "asymptotic")

Arguments

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")

Value

A vector with the lower and upper limits of the confidence interval.

References

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

Examples

IC_SP(0.25, 100, conf.level = 0.95, method = "asymptotic")

Confidence Interval for Seroprevalence with Continuity Correction (Wald Method)

Description

Calculates the confidence interval for seroprevalence using the Wald method with continuity correction.

Usage

IC_SP_Waldcc(SP, n, conf.level = 0.95)

Arguments

SP

Seroprevalence estimate.

n

Sample size.

conf.level

Confidence level (default is 0.95).

Value

A vector with the lower and upper limits of the confidence interval.

Examples

IC_SP_Waldcc(0.25, 100, conf.level = 0.95)

Calculation of Seropositivity Probability

Description

This function calculates the probability of seropositivity based on the age and the seroconversion and seroreversion rates, using a reversible catalytic model.

Usage

prob_seropositive(SCR, SRR, t)

Arguments

SCR

Seroconversion Rate

SRR

Seroreversion Rate.

t

Age for which we want to calculate the probability of seropositivity.

Value

The probability of seropositivity for age 't'.

References

For more information on the reversible catalytic model, see https://link.springer.com/article/10.1186/s12936-015-0661-z

Examples

prob_seropositive(0.03, 0.01, 45)

Sample Size Calculation

Description

Estimates the required sample size so that the confidence interval width for SCR does not exceed a specified limit.

Usage

sample_s(
  SCR,
  RL,
  SRR,
  ages,
  A_max,
  limits,
  max_iter = 10000,
  conf.level = 0.95,
  method = "asymptotic"
)

Arguments

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 SCR.

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.

Details

**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.

Value

A list with the required sample size, the confidence interval for seroprevalence, and the confidence interval for SCR.

Examples

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))

Seroprevalence Calculation

Description

Calculates the seroprevalence considering an age distribution and a reversible catalytic model.

Usage

seroprevalence(ages, A_max, SCR, SRR)

Arguments

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.

Value

The total seroprevalence weighted by the age distribution.

Examples

A_max <- 80
age_distribution <- rep(1 / A_max, A_max)
seroprevalence(age_distribution, A_max, 0.03, 0.01)