powered by
Hardy-Weinberg probabilities
HWprob(allele1, allele2, afreq, f = 0)
A numeric vector of the same length as allele1 and allele2
allele1
allele2
Vectors of equal length, containing alleles in the form of indices of afreq
afreq
A numeric vector with allele frequencies
A single number in [0, 1]; the inbreeding coefficient
[0, 1]
p = 0.1; q = 1-p hw = HWprob(c(1,1,2), c(1,2,2), c(p, q)) stopifnot(all.equal(hw, c(p^2, 2*p*q, q^2)))
Run the code above in your browser using DataLab