pContrib {DNAtools} | R Documentation |
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 |
Computes a vector P(m|n0) evaluated over the plausible range 1,...,m.max.
Returns a vector P(m|n0) for m=1,...,m.max
Torben Tvedebrink, James Curran
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)