Stata Technical Bulletin
35
5. |
M |
M |
6. |
M |
M |
7. |
M |
M |
8. |
M |
M |
9. |
M |
M |
10. |
M |
M |
Each observation corresponds to one of the 747 individuals and records that individual’s genotype; the al variable holds
the value of the first allele, and the a2 variable that of the second allele.
We now perform the test for Hardy-Weinberg equilibrium.
. genhw al a2
Genotype ∣ Observed Expected
------------+-----------------------------
MM I 233 242.37
MN I 385 366.26
NN I 129 138.37
— total |
I 747 |
— 747.00 |
Allele |
I Observed |
Frequency Std. Err. |
— |
— | |
M |
I 851 |
0.5696 0.0125 |
N |
I 643 |
0.4304 0.0125 |
— |
— | |
total |
I 1494 |
1.0000 |
Estimated disequilibrium coefficient (D) = -0.0125
Hardy-Weinberg Equilibrium Test :
Pearson chi2 (1) = 1.956 Pr= 0.1620
likelihood-ratio chi2 (1) = 1.959 Pr= 0.1616
Exact significance prob = 0.1793
The command first tabulates the observed and expected (under HW) genotype frequencies, the allele frequencies, and
corresponding estimated standard errors. Then it calculates Pearson’s and the likelihood-ratio chi-squared statistics, and in the
case of a biallelic locus, an exact significance probability is also reported.
For these data all three Hardy-Weinberg tests agree. They are not statistically significant; therefore, we fail to reject the
null hypothesis that the population is in Hardy-Weinberg equilibrium.
We also obtained an estimate of the disequilibrium coefficient (D). At Hardy-Weinberg equilibrium, the expected value of
the disequilibrium coefficient is zero.
An immediate form of the above command that will yield the same results is constructed using the observed genotype
counts:
. genhwi 233 385 129, label(MM MN NN)
The label () option is used to label the tables. The genhwi command expects the genotype counts to be ordered as shown
in the syntax diagram.
Because there is no statistical evidence that this population is not in Hardy-Weinberg equilibrium, we can rerun the command
specifying the binvar option producing binomial standard error.
genhw al a2, binvar
Genotype I |
Observed |
Expected |
MM I |
233 |
— 242.37 |
MN I |
385 |
366.26 |
NN I |
129 |
138.37 |
____________ total I |
747 |
747.00 |
Allele ∣ |
Observed |
Frequency Std. Err. |
M I |
851 |
— 0.5696 0.0128 (binomial) |
N I |
643 |
0.4304 0.0128 (binomial) |
total I |
1494 |
— 1.0000 |
Estimated disequilibrium coefficient (D) = -0.0125 |