R/pContrib.R
pContrib.Rd
where m ranges from 1 to \(m_{\max}\) and \(n_0\) is the observed locus counts.
pContrib(n0, probs = NULL, m.prior = rep(1/m.max, m.max), m.max = 8, theta = 0)
n0 | Vector of observed allele counts - same length as the number of loci. |
---|---|
probs | List of vectors with allele probabilities for each locus |
m.prior | A vector with prior probabilities (summing to 1), where the
length of |
m.max | Derived from the length of |
theta | The coancestery coefficient |
Returns a vector P(m|n0) for m=1,...,m.max
Computes a vector P(m|n0) evaluated over the plausible range 1,...,m.max.
T. Tvedebrink (2014). 'On the exact distribution of the number of alleles in DNA mixtures', International Journal of Legal Medicine; 128(3):427--37. <https://doi.org/10.1007/s00414-013-0951-3>
## Simulate some allele frequencies: freqs <- simAlleleFreqs() m <- 2 n0 <- sapply(freqs, function(px){ peaks = unique(sample(length(px), size = 2 * m, replace = TRUE, prob = px)) return(length(peaks)) }) ## Compute P(m|n0) for m=1,...,4 and the sampled n0 pContrib(n0=n0,probs=freqs,m.max=4)#> P(m=1|n0) P(m=2|n0) P(m=3|n0) P(m=4|n0) #> 0.000000e+00 9.999777e-01 2.229176e-05 1.361702e-11