Learn R Programming

DNAtools (version 0.1-22)

pContrib: Compute the posterior probabilities for P(m|n0) for a given prior P(m) and observed vector n0 of locus counts

Description

where m ranges from 1 to \(m_{\max}\) and \(n_0\) is the observed locus counts.

Usage

pContrib(n0, probs=NULL, m.prior=rep(1/m.max,m.max), m.max=8, pnoa=NULL, theta=0)

Arguments

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.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

A named list of locus specific probabilities. Output from pNoA with locuswise=TRUE.

theta

The coancestery coefficient

Value

Returns a vector P(m|n0) for m=1,...,m.max

Details

Computes a vector P(m|n0) evaluated over the plausible range 1,...,m.max.

References

T Tvedebrink (2013). 'On the exact distribution of the number of alleles in DNA mixtures', International Journal of Legal Medicine: (under review).

Examples

Run this code
# NOT RUN {
  ## 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="."))
  m <- 2
  n0 <- unlist(lapply(freqs, function(x){
      length(unique(sample(length(x),size=2*m,replace=TRUE,prob=x)))}
      ))
  ## Compute P(m|n0) for m=1,...,4 and the sampled n0
  pContrib(n0=n0,probs=freqs,m.max=4)
# }

Run the code above in your browser using DataLab