Posterior predictive model checks for polyfreqs

Usage

polyfreqs_pps(p_post, tM, rM, ploidy, error)

Arguments

p_post
A matrix containing the posterior samples from a polyfreqs run.
tM
Total reads matrix: matrix containing the total number of reads mapping to each locus for each individual.
rM
Reference reads marix: matrix containing the number of reference reads mapping to each locus for each individual.
ploidy
Ploidy level of individuals in the population.
error
The level of sequencing error. A fixed constant.

Value

A list with two items:
ratio_diff
The posterior predictive samples of the difference between the simulated read ratios and the observed read ratio summed across individuals at each locus.

locus_fit
A logical vector indicating whether or not each locus passed or failed the posterior predictive model check.

Description

Uses the posterior distribution of allele frequences from a polyfreqs run to test model fit using the posterior predictive model checking procedure described in Blischak et al.

Details

The observed read count ratio (r/t) for each locus is summed across individuals and then compared to a distribution of read ratios simulated using the posterior allele frequencies by taking their difference. The criterion for passing/failing the posterior predictive check is then made on a per locus basis based on whether or not the distribution of read ratio differences contains 0 in the 95

References

Blischak PD, LS Kubatko and AD Wolfe. Accounting for genotype uncertainty in the estimation of allele frequencies in autopolyploids. In revision.