## Hardy Weinberg Calculations for Multiple Alleles at a Single Locus.

For a gene locus segregating more than two alleles, the frequency of each allele is the frequency of its homozygote plus 1/2 the sum of the frequencies of all heterozygotes in which it can occur.
### Example of calculation for a multiple allele system

Let's say we have a gene locus with three distinct molecular alleles, "X", "@" and "&". The same shorthand can be used, although there is no distinct dominance/recessiveness implied.
- The frequency of X = p (which also can be written as "f(X)")
- The frequency of @ = q (which also can be written as "f(@)")
- The frequency of & = r (which also can be written as "f(&)")

To calculate your expected genotype frequencies (if the population is in
Hardy Weinberg equilibrium), simply include the additional frequency variable (r):

(p + q + r)^{2}
which expands to...
p^{2} + 2pq + q^{2} + 2pr + 2qr + r^{2} = 1.0
The following genotypes are possible at this locus:

- XX (p
^{2})
- X@ (2pq)
- @@ (q
^{2})
- X& (2pr)
- @& (2qr)
- && (r
^{2})

To calculate the expected genotypes if the population is in HW equilibrium, two of the alleles in homozygous condition (in this case, we'll choose @@ and &&).
Of 1000 individuals sequenced, 200 were @@ (0.2, or 20%) and 50 were && (0.05, or 5% of the population).

The square root of each value to will yield q and r:

square root of q^{2} = 0.44
square root of r^{2} = 0.22
And solve for p:
If p + q + r = 1.0, then 1.0 - 0.44 - 0.22 = p, or 0.34

q = 0.45
r = 0.22
p = 0.33
Plug into the HW equation to calculate the expected relative genotype frequencies, based on homozygous allele frequencies:
p^{2} + 2pq + q^{2} + 2pr + 2qr + r^{2} = 1.0

0.33^{2} + 2(0.33)(0.45) + 0.45^{2} + 2(0.33)(0.22) + 2(0.45)(0.22) + 0.22^{2}

XX (p^{2}) = 0.11
X@ (2pq) = 0.30
@@ (q^{2}) = 0.20
X& (2pr) = 0.14
@& (2qr) = 0.20
&& (r^{2}) = 0.05
Which means that of your 1000 individuals (allowing for slight rounding errors):

110 should be XX
300 should be X@
200 should be @@
140 should be X&
200 should be @&
50 should be &&
...if the popuation is in HW equilibrium with respect to this locus.

Does your population differ significantly from the predicted values?
Your population of 1000 is a sample size of ONE population, and
it *could* be that your observed genotypic ratios are due to
sampling error.

But if your ratios *are* significantly different from those predicted, the next question is to determine *why*.