##' Calculate expected number of true transmission pairs assuming single-transmission and single-linkage
##'
##' This function calculates the expected number of true transmission pairs in a sample of size `M`.
##' The single-transmission and single-linkage method assumes the following:
##' \enumerate{
##' \item Each case \eqn{i} is linked by transmission to only one other case \eqn{j} in the population (\eqn{N}).
##' \item Each case \eqn{i} is linked by the linkage criteria to only one other case \eqn{j} in the sampled population (\eqn{M}).
##' }
##'
##' @param sensitivity scalar or vector giving the sensitivity of the linkage criteria
##' @param rho scalar or vector giving the proportion of the final outbreak size that is sampled
##' @param M scalar or vector giving the number of cases sampled
##'
##' @return scalar or vector giving the expected number of true transmission pairs in the sample
##'
##' @author John Giles, Shirlee Wohl, and Justin Lessler
##'
##' @examples
##' translink_expected_links_true_stsl(sensitivity=0.95, rho=0.2, M=200)
##'
##' @family transmission linkage functions
##'
##' @export
translink_expected_links_true_stsl <- function(sensitivity, rho, M) {
if (!all(is.numeric(sensitivity), sensitivity >= 0 & sensitivity <= 1))
stop("sensitivity must be numeric between 0 and 1")
if (!all(is.numeric(rho), rho > 0 & rho <= 1))
stop("rho must be numeric > 0 and <= 1")
if (!all(is.numeric(M) | is.integer(M), M >= 0))
stop("Sample size (M) must be integer or numeric greater than 0")
(M/2) * sensitivity * rho
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.