# What are the differences in the two possible methods to calculate the Hardy-Weinberg Equation?

I am more than flabbergasted by calculations of Hardy-Weinberg equilibria. The formula's theory assumes a binomal distribution of allele frequencies in a population, and hence allows the comparison of observed phenotype frequencies to an ideal model distribution.

$$p^2 + 2pq + q^2 = 1$$

with

$$p^2$$ = Frequency of homozygous phenotype PP

$$2pq$$ = Frequency of heterozygous phenotype PQ

$$q^2$$ = Frequency of homozygous phenotype QQ

There are two different methods of working with the HW equation that I have come across, and they do not seem to be compatible; used on the same data sets they yield wildly different results. I feel like I'm not seeing the forest for the trees, to be honest.

Is either of these methods (technically) wrong? How do I decide which one to use for each data set (i.e. is it valid to use method #1 on 3-allele-data sets)? Or do I just use whatever method is easiest? Doesn't this lead to discrepancies in the results? This seems like a big thing, especially when comparing real-world observation data to assumed HW distributions.

Example data set (EST/California) and results of HW calculations. I'm using observed phenotype in the place of the original data's observed genotype.

Phenotype     n  |   HW1   HW2p   HW2q
PP           37  |  33.9   37.1   28.8
PQ           20  |  25.0   23.0   28.2
QQ            7  |   4.5    3.8    7.0


## Calculation method #1

As suggested by above-linked data set source and Beebee/Rowe's Introduction to Molecular Ecology, alleles are simply added up to get values for p and q respectively:

Phenotype    n  |   P    Q
PP          37  |  74    0   (37 * PP = 74 P)
PQ          20  |  20   20   (20 * PQ = 20 P + 20 Q)
QQ          7   |   0   14   ( 7 * QQ = 14 Q)
Sums        64  |  94   34


From this we can directly infer p/q: $$p = 94/(94+34) =0.73$$ and $$q = 34/(94+34) = 0.27$$; with the condition $$p + q = 1$$ remaining true.

Using these values for p and q in the HW equation yields: $$p^2 + 2pq + q^2 = 1 \\ (0.73)^2 + 2(0.73)(0.27) + (0.27)^2 = 1$$ And a population-wide phenotype distribution of

Phenotype      n
PP         33.92    p^2 * 64
PQ         24.96    2pq * 64
QQ          4.48    q^2 * 64


## Calculation method #2

The second method of utilising the HW equation is a lot more direct, and just about every text book I could find uses this method to solve 3+ allele problems (as, for example, blood types); Wikipedia commends its usefulness in calculating heterozygote frequencies of genetic diseases in large populations.
In this calculation frequencies are directly inferred as per the definition of the HW equation. This means $$p^2$$ is equal to the frequency of the phenotype PP (see above). $$p^2 = \frac{37}{64} \\ p = {\sqrt 0.578} \\ p \approx 0.76$$ $$q = 1 - p = 0.24$$ Leading to a HW distribution of $$(0.76)^2 + 2(0.76)(0.24) + (0.24)^2 = 1$$

With a new ideal phenotype distribution:

Phenotype      n
PP          37.1    p^2 * 64
PQ          23.0    2pq * 64
QQ           3.8    q^2 * 64


Inverting the calculation by starting with $$q^2 = 7/64$$ leads to even more diverging results:

Phenotype      n
PP          28.8    p^2 * 64
PQ          28.2    2pq * 64
QQ           7.0    q^2 * 64


Using both $$p^2$$ and $$q^2$$ inevitably violates the condition $$(p+q)^2 = 1$$.

• Welcome to SE Biology, which is a question and answer site about biology. You have obviously put a lot of effort into this, but at present I don't see any question. This is, admittedly not my field, but if there is no question posed in the title, begining or end of your post, it is difficult to know what you wish to know. Are you asking which of two types of calculation is correct? If so, please edit your post to make that clear at the outset, otherwise it risks being ruled "off-topic" on the basis of "unclear what you are asking". Oct 4, 2018 at 13:14
• Hi David, I thought his post was clear. Perhaps the title needs to "rogatized," but the questions are in the end of the main post before the computational addenda: "Is either of these methods wrong? Do I have to decide which one to use for each data set? Can I even use method #1 on 3-allele-data sets?" Oct 4, 2018 at 15:36
• Hej David, hej vipatron! You're right that my questions are not as clearly defined as I thought they would be. I would like to know where the differences between those two (three) equation stem, and if either is more valid/accurate than the other model
– G'Ra
Oct 4, 2018 at 19:28
• G'Ra. Please use the @ so I know you have responded to my comment. Only the poster gets automatic notification. You need to edit your question. A comment response is insufficient. @vipatron — A question needs a sentence with a question mark. Oct 4, 2018 at 19:58
• And then there's Gene driving which destroys all of your calculations :-/ Oct 5, 2018 at 8:35

Okay, so the Hardy-Weinberg Equilibrium is just that: an equilbrium.

• In physics, a system (some object) is at equilibrium when no net energy crosses its boundary with the surroundings.
• no energy change means no change in motion (the state of the object) due to outside influence on the system.
• In chemistry, a system (the beaker/reaction container/cytosol) is at equilibrium when no change in the concentration of the chemical species inside of it occurs over time
• no chemical makeup change means the (molecular) state of the atoms in the system is free of energetic influence from the outside world.
• In the H-W Equilibrium, a system (the gene pool) is at rest when no change in the frequency(concentration) of its alleles occurs over time.
• no change in the frequency of alleles means that there is no outside influence on the state of the gene pool.

Just like in basic physics, we have to define our system. If our system is the gene pool, then even the behaviors of the organisms in whose cells those alleles are found are outside of the system. The system is only the alleles aka gene pool.

The most important part about understanding the H-W Equilibrium is that it only applies when those conditions of the gene pool being free from outside influence hold. In fact, in the link you gave, the introduction has it in the second sentence (don't feel bad, I missed it the first few times, too—too focused on applying the algebra to understand what it was really saying):

The model has five basic assumptions:

1) the population is large (i.e., there is no genetic drift)

2) there is no gene flow between populations, from migration or transfer of gametes

3) mutations are negligible

4) individuals are mating randomly

5) natural selection is not operating on the population.

Let's break them down/group them:

• 2: Obvious in terms of equilibrium == system is in isolation from surroundings
• 4 & 5: Selection pressure (4: sexual selection, or 5: natural selection) is not pushing on the system.
• 1 & 3: Random effects are not pushing on the system (1 = statistical sampling error that can push small populations, and 3 = mutation that pushes the system like adding a new chemical species to a system at rest.)

With that solid grounding in the theory, let's move on to your questions about the algebra. Remember, the equilibrium only applies when the gene pool is not being pushed around by external factors. Which means that the physical copies of alleles (gametes) should pair randomly with the possible gametes at every mating. If those assumptions didn't hold true, then the math of the equilibrium wouldn't hold up. If you run the numbers on a system at equilbrium, barring small amounts of sampling error (reducible with a bigger n), the H-W Model's predictions will be accurate. All the methods will yield similar results.

However, if the predicted values don't match the actual with one method, you can assume that other methods will also yield inaccurate predictions, and that the two different calculation methods' predictions will vary widely from each other, largely because of the assumptions you are making (Method 2: 1 = p+q), or aren't making (Method 2).

• Hello vipatron! Thank you for your clarifications. I am aware of the limitations of the HW model, but have to be honest with myself in admitting I've never given them this much thought. But if I'm understanding this right, both modes should -- in an ideal HW population -- yield the same results, but will inevitably lead to skewed distributions as long as "real" (i.e. "non-ideal") populations are observed? Considering that measuring real deviations from the HW model ideal is most I've seen HW used for, doesn't having two options lead to two significantly different results?
– G'Ra
Oct 4, 2018 at 20:03
• I’m not a pure biologist. So, I don’t think I can answer your question except with a supposition backed by experience. Let’s say you were testing a hypothesis: you need to make some estimate of the values for p & q, and then be able to quantify the degree of deviation. Using the “exact method” of allelic frequency count, you can get a single estimate of allelic frequency and then create a null hypothesis about what the gene pool would look like if it were in equilibrium. But, I would prefer to see someone’s real work and explain why they did that rather than talk into the wind. Oct 4, 2018 at 21:57
• Oh, and you are understanding my answer. Oct 4, 2018 at 21:58
• @vipatron Under the listed assumptions, HW equilibrium is reached in a single generation. The term "equilibrium" is hence a little funny and there is not much over time dynamic that would lead to equilibrium. The expression HW rule is also common and it avoids the term "equilibrium". Oct 8, 2018 at 17:19

You are throwing numbers into an equation without understanding it.

If you know the numbers for pp, pq and qq, you don't use HWE to recalculate them. So your last statement in Calculation 1 is nonsense. What you've done there is calculated the proportions for a population in HWE where the p=0.73, but you were already given the actual distribution in the population, so pretending like your theoretical calculation trumps the given data is nonsense.

Calculation 2 only works perfectly if your population is exactly in HWE. Yours is a little off, that's why it won't give you quite the same p and q's as calculating it properly, by actually counting up the p alleles in the homozygotes and heterozygotes.