Chi squared and its p-value
Chi squared is calculated as shown in Genetic Data Analysis by Bruce S. Weir (Sinauer Associates), equation 3.11 on page 117. If n is the number of individuals (2n is the number of chromosomes)
chi squared Χ2 = (2n) D2 / fA fa fB fb
The probability of the chi squared statistic is given by the area under the chi squared distribution between Χ2 and infinity. If we are considering a pair of biallelic markers there is 1 degree of freedom and the p-value is calculated as follows:
(Χ2)-0.5 e-Χ2/2 / (2π)0.5