HWABO: Estimate allele frequencies and test for Hardy-Weinberg...

View source: R/HWABO.R

HWABOR Documentation

Estimate allele frequencies and test for Hardy-Weinberg equilibrium with a tri-allelic ABO system.

Description

Function HWABO takes four genotype counts ("A","B","AB","OO") and estimates the three allele frequencies using the EM algorithm.

Usage

HWABO(x, p = c(1/3, 1/3, 1/3), maxiter = 50, tol = 1e-10, verbose = TRUE) 

Arguments

x

a vector with genotype counts ("A","B","AB","OO").

p

a vector with initial allele frequencies (by default (1/3,1/3,1/3)).

maxiter

maximum number of iterations.

tol

tolerance for convergence, 1e-10 by default

verbose

print iteration history or not.

Value

pn

vector with estimated allele frequencies.

It.hist

iteration history with log-likelihood.

expected

expected genotype counts under HWE.

Author(s)

Jan Graffelman jan.graffelman@upc.edu

See Also

af

Examples

   x <- c(fA=182,fB=60,nAB=17,nOO=176)
   al.fre <- HWABO(x)
#al2 <- HWABO(x,p=c(0.99,0.01,0.01),maxiter=25)
#al3 <- HWABO(x,p=c(0.01,0.99,0.01),maxiter=25)
#al4 <- HWABO(x,p=c(0.01,0.01,0.99),maxiter=25)

HardyWeinberg documentation built on May 29, 2024, 6:17 a.m.