Why an Allele-Frequency Estimate Varies
A population has an allele frequency, but a study usually observes only a sample of individuals. A different random sample could contain a different number of copies of the allele, even if both samples came from the same population. This variation is sampling uncertainty: it is not, by itself, evidence that the population frequency changed or that the population model is wrong.
For a diploid sample, each individual contributes two copies of the locus. The estimated frequency of an allele is therefore the number of copies observed divided by the total number of sampled allele copies. This tutorial derives how much that estimate varies from sample to sample when individuals are sampled independently and genotypes follow Hardy–Weinberg proportions.
Model and Assumptions
The calculation uses the following sampling model. Individuals are sampled randomly and independently from the target population; each is diploid at the locus; and the genotype probabilities are \(P(AA)=p^2\), \(P(Aa)=2pq\), and \(P(aa)=q^2\). These are the Hardy–Weinberg genotype probabilities for allele frequencies \(p\) and \(q\). The sample size \(n\) is fixed, and all genotypes are observed correctly.
The model implies that an individual's two allele copies can be represented as independent draws, each having probability \(p\) of being \(A\). It also implies independence of genotype outcomes across sampled individuals. These assumptions matter: the variance derived below is for this model, not a universal formula for every way of collecting genetic data.
Deriving the Sampling Variance
Let \(G_i\) be the number of \(A\) copies in individual \(i\), so \(G_i\) is 0, 1, or 2. Under the stated genotype probabilities, \(G_i\) has probabilities \(q^2\), \(2pq\), and \(p^2\), respectively. The estimate is the average number of \(A\) copies per sampled allele: $$ \hat{p}=\frac{1}{2n}\sum_{i=1}^{n}G_i. $$
For one individual, the expected number of \(A\) copies is $$ E(G_i)=0(q^2)+1(2pq)+2(p^2)=2pq+2p^2=2p(p+q)=2p. $$ The second moment is \(E(G_i^2)=2pq+4p^2\). Therefore, $$ \operatorname{Var}(G_i)=E(G_i^2)-[E(G_i)]^2 =2pq+4p^2-4p^2=2pq. $$ Since the \(n\) sampled individuals are independent, the variance of their sum is the sum of their variances. Dividing by \(2n\) multiplies variance by \(1/(2n)^2\), giving the result below.
There is another way to see the same result. Under Hardy–Weinberg sampling, the \(2n\) allele copies behave as independent draws with probability \(p\) of being \(A\). If \(K=2n\hat{p}\) is the total number of sampled \(A\) copies, then \(K\sim\operatorname{Binomial}(2n,p)\). The binomial variance is \(2npq\), so $$ \operatorname{Var}(\hat{p})=\operatorname{Var}\left(\frac{K}{2n}\right) =\frac{2npq}{(2n)^2}=\frac{pq}{2n}. $$ This allele-copy representation is a consequence of the sampling model; it does not mean that two copies from every observed individual can be treated as independent under any possible population or sampling process.
Calculating an Estimated Standard Error
The formula for the true standard error contains the population frequencies \(p\) and \(q\), which are usually unknown. A practical estimate substitutes the sample frequency \(\hat{p}\) for \(p\), and \(1-\hat{p}\) for \(q\): $$ \widehat{SE}(\hat{p})=\sqrt{\frac{\hat{p}(1-\hat{p})}{2n}}. $$ This is an estimated standard error, not the exact standard error unless the substituted frequency happens to equal the population frequency. It summarizes the estimated amount of sample-to-sample variation under the model.
Worked Example: Estimating the Frequency and Its Standard Error
Suppose a hypothetical random sample contains \(n=200\) diploid individuals: 72 with genotype \(AA\), 96 with genotype \(Aa\), and 32 with genotype \(aa\). Assume the sample is drawn independently from a population that follows the stated Hardy–Weinberg model, with genotypes measured without error. Estimate the frequency of \(A\) and its standard error.
The genotype counts sum to \(72+96+32=200\). The number of \(A\) copies is \(2(72)+96=240\), out of \(2(200)=400\) total allele copies. Therefore, $$ \hat{p}=\frac{240}{400}=0.600. $$ The estimated frequency of \(a\) is \(1-\hat{p}=0.400\). Substituting into the estimated standard error formula gives $$ \widehat{SE}(\hat{p}) =\sqrt{\frac{0.600(0.400)}{2(200)}} =\sqrt{\frac{0.240}{400}} =\sqrt{0.000600} =0.02449. $$ The estimate is 0.600, or 60.0% of the sampled allele copies. Under the sampling model, the estimated standard deviation of this frequency estimate across repeated samples of 200 individuals is about 0.0245, or 2.45 percentage points.
Worked Example: A Lower-Frequency Allele in a Larger Sample
In another hypothetical sample, \(n=500\) individuals have genotypes \(AA=2\), \(Aa=45\), and \(aa=453\). The counts sum to 500, and the number of \(A\) copies is \(2(2)+45=49\). Assuming independent random sampling and Hardy–Weinberg genotype probabilities, calculate the estimated frequency and standard error.
There are \(2(500)=1000\) allele copies, so $$ \hat{p}=\frac{49}{1000}=0.0490. $$ The estimated frequency of \(a\) is \(0.951\). The plug-in estimated standard error is $$ \widehat{SE}(\hat{p}) =\sqrt{\frac{0.0490(0.951)}{1000}} =\sqrt{0.000046599} =0.006826. $$ In this sample, the estimated frequency of \(A\) is 4.90%, with an estimated standard error of about 0.683 percentage points. This calculation describes uncertainty under the assumed sampling model; it does not establish that the assumptions hold merely because a standard error can be computed.
How Sample Size and Frequency Affect Uncertainty
The variance \(pq/(2n)\) makes two useful patterns explicit. First, increasing \(n\) decreases the variance in proportion to \(1/n\), and decreases the standard error in proportion to \(1/\sqrt{n}\). To halve the standard error, a study generally needs four times as many individuals, not twice as many. Second, \(pq\) is largest when \(p=q=0.5\), so for a fixed sample size the standard error is largest when the two alleles have equal frequencies. As either allele becomes very rare, the model-based standard error becomes smaller in absolute frequency units.
Worked Example: Planning a Sample Size for a Target Standard Error
A researcher wants the standard error of the estimated frequency of \(A\) to be no greater than 0.010 under the Hardy–Weinberg sampling model. Suppose the allele frequency is not known in advance and the researcher wants a sample size that meets this target for any biallelic frequency. Find a sufficient sample size.
Because \(pq=p(1-p)\leq 0.25\), the largest model-based variance for any allele frequency is \(0.25/(2n)\). Thus a sufficient condition is $$ \sqrt{\frac{0.25}{2n}}\leq 0.010. $$ Squaring both sides and rearranging gives $$ \frac{0.25}{2n}\leq 0.0001,\qquad n\geq\frac{0.25}{2(0.0001)}=1250. $$ A sample of 1,250 diploid individuals therefore gives a model-based standard error no greater than 0.010 for any \(p\). At \(p=0.5\), the bound is attained; at other allele frequencies the formula gives a smaller standard error. This calculation addresses sampling precision under the specified model, not other sources of error such as biased recruitment or inaccurate genotyping.
What the Standard Error Does and Does Not Say
A standard error measures variability of an estimator across repeated samples under a specified model. It is not the observed variation among individuals, and it is not a measure of the number of genotype categories. Here, the units of \(\hat{p}\) and its standard error are frequency units: for example, 0.01 corresponds to one percentage point.
The formula relies on independent sampling and Hardy–Weinberg genotype probabilities. If individuals are related or otherwise dependent, the variance of the sum of their allele counts need not equal the sum of individual variances. If the sampling process systematically overrepresents some people or genotypes, the sample estimate may also fail to represent the target population. In such cases, simply inserting the observed \(\hat{p}\) into the formula does not repair the mismatch between the model and the data.
Common Pitfall
- Wrong reasoning: “There are \(2n\) alleles, so the standard error must be \(\sqrt{pq/(2n)}\) for any sample of diploid individuals.”
- Correction: The expression follows from the stated independent Hardy–Weinberg sampling model. The model justifies treating allele-copy indicators as independent Bernoulli draws; diploidy alone does not. Check the sampling and genotype assumptions before using the formula.
- Another common error: using \(n\), rather than \(2n\), in the denominator while estimating an allele frequency from diploid individuals. There are \(2n\) allele copies, so the estimator and its variance must reflect that denominator.
Check Your Understanding
Use the definitions and sampling model in this tutorial to answer the questions.
- In a sample of 80 diploid individuals, how many allele copies are in the denominator of the estimate \(\hat{p}\)?
- Under the stated model, show why the variance of one individual's \(A\)-copy count is \(2pq\).
- If \(p=0.3\) and \(n=100\), calculate the model-based standard error of \(\hat{p}\).
- Why does the estimated standard error use \(\hat{p}(1-\hat{p})\) when the population frequency is unknown?
- For a fixed allele frequency, what happens to the standard error if the sample size is multiplied by four?