# MathBench>Population Dynamics

## Using a chi-square to test for H-W genotypic frequencies

Now may be a good time to review the chi-square test if you need to (see the Goodness of Fit module). The table below will help you keep track of the calculations required. You don't need to enter the exact numbers -- as long as you are reasonably close, the program will fix the answers and gray them out when you click the "check" buttons.

Remember, you're trying to show that the study's distribution of genotypes (62:36:2) does, in fact, fit the Hardy-Weinberg model (61:34:5).

 group o e o-e (o-e)2 (o-e)2/e Homoz. Brown Carriers Homoz. Blue Total

New!! Breaking News!! How many degrees of freedom does the test have? NORMALLY, the degrees of freedom in a chi-square test are equal to the number of observations minus 1. (Essentially, if I know total number of observations and how many are in all but 1 group, I can guess how many observations were in the last group, so that group has no 'freedom'). HOWEVER, this is not true for testing the Hardy-Weinberg equilibrium. INSTEAD, you have to think about how many quantities are really free to vary --> remember that we used the population to estimate p and q, then we used p and q to get p2, 2pq, and q2. So really, once we decided on a value for p, everything else was decided for us. Whatever p was, q had to be 1-p, and p2, 2pq, and q2 were set as well. SO, the moral of the story is, since only p is able to vary, there is ONLY ONE degree of freedom in this chi-square test.* Whew!

Given that df = 1, and based on the lookup table to the right, do the observed proportions fit the Assistant's predictions?

Really Gory Details That You Don't Need to Know But I'm Including for the Sake of Completeness: If you are doing a chi-square test of Hardy-Weinberg proportions for multiple genes (for example, hair color AND earlobe attachment), there is a general rule for the degrees of freedom, which is:

df = # genotypic combinations - # alleles.

So for 2 genes, there are 9 genotypic combinations (3 genotypes for hair color x 3 genotypes for ear attachment) and 4 associated alleles (2 each for hair color and ear attachment), so df = 9 - 4 = 5.