# Additive disequilibrium and z statistic

Additive disequilibrium (D) is a statistic that estimates the difference between observed genotypic frequencies and the genotypic frequencies that would be expected under Hardy–Weinberg equilibrium. At a biallelic locus with alleles 1 and 2, the additive disequilibrium exists according to the equations
    ${\begin{aligned}f_{11}&=p_{1}^{2}+D\\[5pt]f_{12}&=2p_{1}(1-p_{1})-2D\\[5pt]f_{22}&=(1-p_{1})^{2}+D\end{aligned}}$
where f$_{ij}$ is the frequency of genotype ij in the population, p is the allele frequency in the population, and D is the additive disequilibrium coefficient.
Having a value of D > 0 indicates an excess of homozygotes/deficiency of heterozygotes in the population, whereas D < 0 indicates an excess of heterozygotes/deficiency of homozygotes. When D = 0, the genotypes are considered to be in Hardy Weinberg Equilibrium. In practice, the estimated additive disequilibrium from a sample, ${\widehat {D}}$ , will rarely be exactly 0, but it may be small enough to conclude that it is not significantly different from 0. Finding the value of the additive disequilibrium coefficient provides an alternative assessment in accepting or rejecting Hardy Weinberg Equilibrium in a set of genotypic frequencies.
Because the genotype and allele frequencies must be positive numbers in the interval (0,1), there exists a constraint on the range of possible values for D, which is as follows:
    $\max _{u\,\in \,(1,2)}-p_{u}^{2}\leq D\leq p_{1}(1-p_{1})$
To estimate D from a sample, use the formula:
    ${\widehat {D}}={\widehat {f}}_{11}-{\widehat {p}}_{1}^{2}={\frac {n_{11}}{n}}-\left({\frac {2n_{11}+n_{12}}{2n}}\right)^{2}$
where n$_{11}$ (n$_{12}$) is the number of individuals in the sample with that particular genotype and n is the total number of individuals in the sample. Note that ${\widehat {f}}_{11}$ and ${\widehat {p}}_{1}$ are sample estimates of the population genotype and allele frequencies.
The approximate sampling variance of ${\widehat {D}}$ (given by $\operatorname {var} ({\widehat {D}})$) is:
    $\operatorname {var} {\widehat {D}}={\frac {{\widehat {p}}_{1}^{2}(1-{\widehat {p}}_{1}^{2})}{n}}$
From this an estimated 95% confidence interval can be calculated, which is
    ${\widehat {D}}\pm 1.96{\sqrt {\operatorname {var} ({\widehat {D}})}}$
Note: ${\sqrt {\operatorname {var} ({\widehat {D}})}}$ is also equal to the estimated standard deviation .
If the confidence interval for ${\widehat {D}}$ does not include zero, we can reject the null hypothesis for Hardy Weinberg Equilibrium.
       $z={\frac {{\widehat {D}}{\sqrt {n}}}{{\widehat {p}}_{1}(1-{\widehat {p}}_{1})}}$
When z is large, ${\widehat {D}}$ and thus the departure from Hardy Weinberg Equilibrium are also large. If the value of z is sufficiently large, it is unlikely that the deviations would occur by chance and thus the hypothesis of Hardy Weinberg Equilibrium can be rejected.
To determine if z is significantly larger or smaller than expected under Hardy Weinberg Equilibrium, find "the probability of observing" a value as or more extreme as the observed z "under the null hypothesis". The tail probability is normally used, $\mathbb {P}$(y > z), where y is standard normal random variable. When z is positive, the tail probability is 1 − $\mathbb {P}$(y ≤ z). Because normal distributions are symmetric, the upper and lower tail probabilities will be equal, and thus you can find the upper probability and multiply by 2 to find the combined tail probabilities.
If z is negative, find the negative tail probability, $\mathbb {P}$(y ≤ z), and multiply by 2 to find the combined probability in both upper and lower tails.
The probability values calculated from these equations can be analyzed by comparison to a pre-specified value of α. When the observed probability p ≤ α, we can "reject the null hypothesis of Hardy Weinberg Equilibrium". If p > α, we fail to reject the null hypothesis. Commonly used values of α are 0.05, 0.01, and 0.001.
At a significance of α = 0.05, we can reject the hypothesis of Hardy Weinberg Equilibrium if the absolute value of z is "greater than or equal to the critical value 1.96" for the two-sided test.