Computes the exact distribution of the number of alleles in a $$m$$-person DNA mixture typed with STR loci. For a m-person DNA mixture it is possible to observe $$1,\ldots,2\times m \times L$$ alleles, where $$L$$ is the total number of typed STR loci. The method allows incorporation of the subpopulation correction, the so-called $$\theta$$-correction, to adjust for shared ancestry. If needed, the locus-specific probabilities can be obtained using the locuswise argument.

Pnm_all(m, theta, probs, locuswise = FALSE)
Pnm_locus(m, theta, alleleProbs)

## Arguments

m The number of contributors The coancestery coefficient List of vectors with allele probabilities for each locus Logical. If TRUE the locus-wise probabilities will be returned. Otherwise, the probability over all loci is returned. Vectors with allele probabilities

## Value

Returns a vector of probabilities, or a matrix of locuswise probability vectors.

## Details

Computes the exact distribution of the number of alleles for a m-person DNA mixture.

## 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 <-  structure(replicate(10, { g = rgamma(n = 10, scale = 4, shape = 3);
g/sum(g)
},
simplify = FALSE), .Names = paste('locus', 1:10, sep = '.'))

## Compute \eqn{\Pr(N(m = 3) = n)}, \eqn{n = 1,\ldots,2 * L *m}, where \eqn{L = 10}
## here
Pnm_all(m = 2, theta = 0, freqs)#>            1            2            3            4            5            6
#> 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>            7            8            9           10           11           12
#> 0.000000e+00 0.000000e+00 0.000000e+00 1.942242e-24 5.543109e-22 7.292726e-20
#>           13           14           15           16           17           18
#> 5.878483e-18 3.255642e-16 1.317186e-14 4.042732e-13 9.653068e-12 1.825469e-10
#>           19           20           21           22           23           24
#> 2.770483e-09 3.409100e-08 3.428781e-07 2.837183e-06 1.941626e-05 1.103509e-04
#>           25           26           27           28           29           30
#> 5.224765e-04 2.065100e-03 6.820962e-03 1.882553e-02 4.336021e-02 8.312557e-02
#>           31           32           33           34           35           36
#> 1.320806e-01 1.728655e-01 1.847290e-01 1.592194e-01 1.087899e-01 5.747393e-02
#>           37           38           39           40
#> 2.260729e-02 6.225429e-03 1.069792e-03 8.627028e-05   ## Same, but locuswise results
Pnm_all(m = 2, theta = 0, freqs, locuswise = TRUE)#>                    1          2         3         4
#> locus.1  0.004509230 0.11555881 0.4807493 0.3991826
#> locus.2  0.006440907 0.13856123 0.4922725 0.3627253
#> locus.3  0.002101605 0.08137847 0.4515649 0.4649550
#> locus.4  0.006604252 0.13690818 0.4932685 0.3632191
#> locus.5  0.002373395 0.09268969 0.4730040 0.4319329
#> locus.6  0.009941674 0.16324419 0.4988447 0.3279695
#> locus.7  0.006649907 0.13305449 0.4882864 0.3720092
#> locus.8  0.004932047 0.13527870 0.5032450 0.3565442
#> locus.9  0.001984470 0.08453274 0.4600866 0.4533962
#> locus.10 0.003137346 0.10446497 0.4782669 0.4141307