plot_prior_COI.Rd
Produce plot of the prior on COI for given parameters. Options include the uniform distribution, and a modified form of Poisson and negative binomial distribution (see details).
plot_prior_COI(COI_model = "poisson", COI_mean = 3, COI_dispersion = 2, COI_max = 20)
COI_model | the type of prior on COI. Must be one of "uniform", "poisson", or "nb" (negative binomial) |
---|---|
COI_mean | the prior mean (before truncating at |
COI_dispersion | the ratio of the variance to the mean of the prior on COI. Only applies under the negative binomial model. Must be >1 |
COI_max | the maximum COI allowed. Distributions are truncated at this value |
The prior on COI can be uniform, Poisson, or negative binomial. In
the uniform case there is an equal chance of any given sample having a COI
between 1 and COI_max
(inclusive). In the Poisson and negative
binomial cases it is important to note that the distribution is over
(COI-1), rather than over COI. This is because both Poisson and negative
binomial distributions allow for 0 values, which cannot be the case here
because observed samples must contain at least 1 genotype. Poisson and
negative binomial distributions are also truncated at COI_max
.
The full probability mass distribution for the Poisson case with
COI_mean
\( = \mu\) and COI_max
\( = M\) can be written
$$ Pr(COI = n) = z (\mu-1)^(n-1) exp(-(\mu-1)) / (n-1)! $$ where \(z\)
is a normalising constant that ensures the distribution sums to unity, and
is defined as: $$1/z = \sum_{i=1}^M (\mu-1)^(i-1) exp(-(\mu-1)) /
(i-1)! $$
The mean of this distribution will generally be very close to \(\mu\), and the variance will be close to \(\mu-1\) (strictly it will approach these values as \(M\) tends to infinity).
The full probability mass distribution for the negative binomial case with
COI_mean
\( = \mu\), COI_dispersion
\( = v/\mu\) and
COI_max
\( = M\) can be written $$ Pr(COI = n) = z
\Gamma(n-1+N)/( \Gamma(N)(n-1)! ) p^N (1-p)^(n-1) $$ where \(N =
(\mu-1)^2/(v-\mu+1)\), \(p = (\mu-1)/v\), and \(z\) is a normalising
constant that ensures the distribution sums to unity, and is defined as:
$$1/z = \sum_{i=1}^M \Gamma(i-1+N)/( \Gamma(N)(i-1)! ) p^N (1-p)^(i-1)
$$
The mean of this distribution will generally be very close to \(\mu\) and the variance will be close to \(v\) (strictly it will approach these values as \(M\) tends to infinity).