Compute a matrix of posterior probabilties \(\Pr(m|n_0)\) where \(m\) ranges from 1 to \(m_{\max}\), and \(n_0\) is \(0,\ldots,2m_{\max}\). This is done by evaluating \(\Pr(m|n_0)=Pr(n_0|m)Pr(m)/Pr(n)\), where \(\Pr(n_0|m)\) is evaluated by pNoA.

pContrib_locus(
  prob = NULL,
  m.prior = NULL,
  m.max = 8,
  pnoa.locus = NULL,
  theta = 0
)

Arguments

prob

Vectors with allele probabilities for the specific locus

m.prior

A vector with prior probabilities (summing to 1), where the length of m.prior determines the plausible range of \(m\)

m.max

Derived from the length of m.prior, and if m.prior=NULL a uniform prior is speficied by m.max: m.prior = rep(1/m.max,m.max).

pnoa.locus

A named vector of locus specific probabilities \(P(N(m)=n), n=1,\ldots,2m\).

theta

The coancestery coefficient

Value

Returns a matrix \([\Pr(m|n_0)]\) for \(m = 1,\ldots,m.max\) and \(n_0 = 1,\ldots,2m.max\).

Details

Computes a matrix of \(\Pr(m|n_0)\) values for a specific locus.

References

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>

Examples

## Simulate some allele frequencies: freqs <- simAlleleFreqs() ## Compute Pr(m|n0) for m = 1, ..., 5 and n0 = 1, ..., 10 for the first locus: pContrib_locus(prob = freqs[[1]], m.max = 5)
#> P(m|n0) #> m #> n0 1 2 3 4 5 #> 1 0.9721542 0.02692804 0.0008858613 3.079525e-05 1.099809e-06 #> 2 0.8689127 0.11678007 0.0126987639 1.436160e-03 1.723236e-04 #> 3 0.0000000 0.72459248 0.2124911535 5.095238e-02 1.196398e-02 #> 4 0.0000000 0.36161837 0.3787613396 1.845505e-01 7.506984e-02 #> 5 0.0000000 0.00000000 0.3463230458 3.843404e-01 2.693366e-01 #> 6 0.0000000 0.00000000 0.1068942680 3.902536e-01 5.028521e-01 #> 7 0.0000000 0.00000000 0.0000000000 2.649692e-01 7.350308e-01 #> 8 0.0000000 0.00000000 0.0000000000 1.019138e-01 8.980862e-01 #> 9 0.0000000 0.00000000 0.0000000000 0.000000e+00 1.000000e+00 #> 10 0.0000000 0.00000000 0.0000000000 0.000000e+00 1.000000e+00