For my analysis of genotype data I need to calculate whether the observed allele frequencies are in Hardy-Weinberg equilibrium.
In order to do so, one manually calculates the expected allele frequencies and then test the observed frequencies against the expected frequencies using a Chi Square test. There are plenty nice calculators for this job available on the web and my 'problem' therefore isn't all that urgent. Nonetheless, I would like to write an SPSS syntax to do this job. However: when performing the actual chi square test (using the Npar chi square option, not the crosstabs one, of course), SPSS uses 2 degrees of freedom. This makes sense as there are actually three groups and three observed frequencies (alleles AA, Aa and aa). However: to test for Hardy-Weinberg equilibrium, the chi square test should be performed with one degree of freedom. I believe that this is because the test is essentially testing the frequency of two alleles (A and a) although in three possible combinations.
Therefore: I am looking for a way to trick SPSS into using one degree of freedom rather than two.
I figured that this poses a nice little problem and I hope that some of you may have some idea's on how to solve it.