Learn R Programming

RCMsize (version 1.0.1)

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

Value

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

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.

Examples

Run this code
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))

Run the code above in your browser using DataLab