gdistPair2: Genetic distance for data with genotyping errors

Description Usage Arguments Value

View source: R/unfazeD.R

Description

Distance when estimated COI is less than |Ux|: likelihoods for all subsets of size = COI of Ux are calculated; geometric mean taken.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
gdistPair2(
  pair,
  afreq,
  coi,
  nr = 100,
  nm = min(coi),
  rval = NULL,
  reval = NULL,
  equalr = FALSE,
  out = "mle"
)

Arguments

pair

a list of length two containing two samples.

afreq

a list of allele frequencies. Each element of the list corresponds to a locus.

coi

a vector indicating complexity of infection for each sample.

nr

an integer value for the resolution of the grid (nr - 1 values between 0 and 1), over which the likelihood will be calculated. Ignored if non-null reval is provided.

nm

the number of related pairs of strains for evaluation.

rval

{r} values for the grid or for evaluation when equalr is TRUE. If NULL, will be evenly spaced between 0 and 1 and interval 1/nr.

reval

the grid of {r} combinations, over which the likelihood will be calculated. A matrix where each column represents a single combination.

equalr

a logical value. If TRUE, only equal values of r for different pairs of strains are evaluated.

out

a character string for the type of results to be returned. If "mle", an estimate is returned, if "llik" - a vector of log-likelihood for each combination.

Value

If out is "mle", a vector of length 1 if equalr is TRUE or length nm otherwise, containing estimated {r} (or vector/matrix if not just first). If out is "llike", a vector of log-likelihood values for each evaluated combination.


innager/unfazeD documentation built on June 26, 2021, 6:01 p.m.