This function assumes you want to correct for imbalance, if not there is a closed form solution for the estimated sample size that does not include uncertainty bounds. (see relR_samplesize).

relR_samplesize_ci(
  R_a,
  R_b,
  p_a,
  N,
  alpha = 0.05,
  alternative = c("two_sided", "less", "greater"),
  power = 0.8,
  sensitivity = 1,
  specificity = 1,
  overdispersion = NULL,
  nsims = 1000,
  uncertainty_percent = 0.95,
  B = 1000
)

Arguments

R_a

Numeric (Positive). The assumed R among the group in the denominator of the ratio. Input value must be greater than 0.

R_b

Numeric (Positive). The assumed R among the group in the numerator of the ratio. Input value must be greater than 0.

p_a

Numeric. The proportion of the population in group a. Must be between 0 and 1.

N

Numeric (Positive). The size of the infected pool. Only one of rho or N should be specified.

alpha

Numeric. The desired alpha level. Default: 0.05

alternative

Character. Specifies the alternative hypothesis. Must be: two_sided (Default), less, or greater

power

Numeric. The desired power. Must be a value between 0 and 1. Default: 0.8.

sensitivity

Numeric. The sensitivity of the linkage criteria. Must be between 0 and 1. Default: 1.

specificity

Numeric. The specificity of the linkage criteria. Must be between 0 and 1. Default: 1.

overdispersion

Numeric (Positive). An overdispersion parameter, set if the assumed distribution of the number of edges is negative binomial. If NULL the assumed distribution is Poisson (equivalent to an overdispersion parameter of infinity) Default: NULL Note that this is equivalent to setting the overdispersion parameter to Inf.

nsims

The number of inner simulations run per estimate. Default: 10000

uncertainty_percent

The percent of the uncertainty interval. Default: .95

B

The number of outer simulations run to estimate the uncertainty. Default: 1000

Value

A vector with three quantities:

  • sample size: Sample size needed achieve desired type I and II error rates under assumptions. Will return NA and throw a warning if impossible.

  • lower bound: The lower bound of an uncertainty interval

  • upper bound: The upper bound of an uncertainty interval