Skip to contents

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.

Value

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

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

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))
#> $n
#> [1] 57
#> 
#> $ci_sp
#> [1] 0.4000717 0.6592185
#> 
#> $ci_scr
#> [1] 0.0187055 0.0486105
#>