Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

HWPosterior

Calculation of posterior probabilities and Bayes factors for Hardy-Weinberg tests at X-chromosomal variants.


Description

Function HWPosterior calculates posterior probabilities and Bayes factors for tests for Hardy-Weinberg equilibrium of autosomal and X-chromosomal variants.

Usage

HWPosterior(X, verbose = TRUE, prior.af = c(0.5,0.5), prior.gf =
            c(0.333,0.333,0.333), x.linked = FALSE, precision = 0.05)

Arguments

X

A vector of genotype counts. The order c(A,B,AA,AB,BB) is assumed. Differently ordered vectors can be supplied but then elements must be labeled by their genotype

verbose

prints results if verbose = TRUE

prior.af

Beta prior parameters for male and female allele frequencies

prior.gf

Dirichlet prior parameters for female genotype frequencies

x.linked

logical indicating whether the variant is autosomal or X-chromosomal

precision

precision parameter for marginal likelihoods that require numeric integration

Details

For X-chromosomal variants, four possible models are considered, and the posterior probabilities and Bayes factors for each model are calculated.

For autosomal variants, ten possible scenarios are considered, and the posterior probabilities for all models are calculated.

In general, default Dirichlet priors are used for genotype frequencies, and beta prior are used for allele frequencies.

Value

For X-chromosomal variants, a matrix with posterior probabilities and Bayes factors will be produced. For autosomal variants, a vector of posterior probabilities is produced.

Author(s)

Xavi Puig xavier.puig@upc.edu and Jan Graffelman jan.graffelman@upc.edu

References

Puig, X., Ginebra, J. and Graffelman, J. (2017) A Bayesian test for Hardy-Weinberg equilibrium of bi-allelic X-chromosomal markers. To appear in Heredity.

See Also

Examples

#
# An X-chromosomal example
#
x <- c(A=43,B=13,AA=26,AB=19,BB=3)
out <- HWPosterior(x,verbose=TRUE,x.linked=TRUE)
#
# An autosomal example
#
data(JPTsnps)
post.prob <- HWPosterior(JPTsnps[1,],x.linked=FALSE)

HardyWeinberg

Statistical Tests and Graphics for Hardy-Weinberg Equilibrium

v1.7.2
GPL (>= 2)
Authors
Jan Graffelman [aut, cre], Christopher Chang [ctb], Xavi Puig [ctb], Jan Wigginton [ctb], Leonardo Ortoleva [ctb], William R. Engels [ctb]
Initial release
2021-04-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.