Chisquare goodness of fit tests are often used in genetics. One common application is to check if two genes are linked (i.e., if the assortment is independent). When genes are linked, the allele inherited for one gene affects the allele inherited for another gene.
Suppose that you want to know if the genes for pea texture (R = round, r = wrinkled) and color (Y = yellow, y = green) are linked. You perform a dihybrid cross between two heterozygous (RY / ry) pea plants. The hypotheses you’re testing with your experiment are:
 Null hypothesis (H_{0}): The population of offspring have an equal probability of inheriting all possible genotypic combinations.
 This would suggest that the genes are unlinked.
 Alternative hypothesis (H_{a}): The population of offspring do not have an equal probability of inheriting all possible genotypic combinations.
 This would suggest that the genes are linked.
You observe 100 peas:
 78 round and yellow peas
 6 round and green peas
 4 wrinkled and yellow peas
 12 wrinkled and green peas
Step 1: Calculate the expected frequencies
To calculate the expected values, you can make a Punnett square. If the two genes are unlinked, the probability of each genotypic combination is equal.

RY 
ry 
Ry 
rY 
RY 
RRYY 
RrYy 
RRYy 
RrYY 
ry 
RrYy 
rryy 
Rryy 
rrYy 
Ry 
RRYy 
Rryy 
RRyy 
RrYy 
rY 
RrYY 
rrYy 
RrYy 
rrYY 
The expected phenotypic ratios are therefore 9 round and yellow: 3 round and green: 3 wrinkled and yellow: 1 wrinkled and green.
From this, you can calculate the expected phenotypic frequencies for 100 peas:
Phenotype 
Observed 
Expected 
Round and yellow 
78 
100 * (9/16) = 56.25 
Round and green 
6 
100 * (3/16) = 18.75 
Wrinkled and yellow 
4 
100 * (3/16) = 18.75 
Wrinkled and green 
12 
100 * (1/16) = 6.21 
Step 2: Calculate chisquare
Phenotype 
Observed 
Expected 
O − E 
(O − E)2 
(O − E)2 / E 
Round and yellow 
78 
56.25 
21.75 
473.06 
8.41 
Round and green 
6 
18.75 
−12.75 
162.56 
8.67 
Wrinkled and yellow 
4 
18.75 
−14.75 
217.56 
11.6 
Wrinkled and green 
12 
6.21 
5.79 
33.52 
5.4 
Χ^{2} = 8.41 + 8.67 + 11.6 + 5.4 = 34.08
Step 3: Find the critical chisquare value
Since there are four groups (round and yellow, round and green, wrinkled and yellow, wrinkled and green), there are three degrees of freedom.
For a test of significance at α = .05 and df = 3, the Χ^{2} critical value is 7.82.
Step 4: Compare the chisquare value to the critical value
Χ^{2} = 34.08
Critical value = 7.82
The Χ^{2} value is greater than the critical value.
Step 5: Decide whether the reject the null hypothesis
The Χ^{2} value is greater than the critical value, so we reject the null hypothesis that the population of offspring have an equal probability of inheriting all possible genotypic combinations. There is a significant difference between the observed and expected genotypic frequencies (p < .05).
The data supports the alternative hypothesis that the offspring do not have an equal probability of inheriting all possible genotypic combinations, which suggests that the genes are linked