Skip to contents

The MOIs returned correspond to the parsimonious explanation of the data, i.e., the minimal MOIs required to support the observed allelic diversity.

Usage

determine_MOIs(y, return.names = FALSE)

Arguments

y

Observed data in the form of a list of lists. The outer list is a list of episodes in chronological order. The inner list is a list of named markers per episode. For each marker, one must specify an allelic vector: a set of distinct alleles detected at that marker.

return.names

Logical; if TRUE and episodes are named, episode names are returned.

Value

Returns a vector of the (minimum) multiplicity of infection (MOI) for each infection.

Details

For a given episode, the minimal MOI required to support the observed allelic diversity is equal to the maximum number of per-marker alleles observed across markers. These MOIs are the default used by compute_posterior.

At present, Pv3Rs only supports prevalence data (categorical data that signal the detection of alleles), not quantitative (proportional abundance) data. Allele repeats at markers with observed data, and repeat NAs at markers with missing data, are removed. NAs in allelic vectors that also contain non-NA values are ignored.

Examples

# two infections, three markers
y <- list(
  list(m1 = c("A", "B"), m2 = c("A"), m3 = c("C")),
  list(m1 = c("B"), m2 = c("B", "C"), m3 = c("A", "B", "C"))
)
determine_MOIs(y) # should be c(2, 3)
#> [1] 2 3