The assortative mating matrix
A 3 by 3 grid of allowed crosses, plus a rule for forbidden ones, decides which genotypes survive and where the allele frequency ends up.
Read first: Assortative mating
A grid of allowed crosses
The Assortative Mating page offers three mating rules. This module generalises them. You mark, cross by cross, which female by male pairings are allowed, and the module iterates the genotype frequencies under that rule.
There are six distinct crosses at one locus: AA×AA, AA×Aa, AA×aa, Aa×Aa, Aa×aa and aa×aa. The grid is symmetric, so AA×Aa and Aa×AA switch together. That gives 2^6 = 64 patterns, and 14 of them match a named model. Models 1, 2 and 3 are the three rules of the Assortative Mating page. Only the 14 presets run. A pattern with no match, random mating included, shows "Invalid mating pattern".
The second choice is the variant, which says what a forbidden cross does. Both variants use the same Mendelian offspring ratios, and both renormalise the offspring to sum to 1. They differ in who loses out.
Two edge cases follow from the rules. A genotype with frequency below 10⁻¹² counts as absent, so a vanished allele does not return. If no fertile mating is possible at all, for example Model 3 in a population that is all AA, the population is returned unchanged and no error appears.
Forbidden: females choose again
In the forbidden variant a forbidden cross never happens. A female of genotype i mates with an allowed male j with probability f_j divided by the total frequency of the males allowed for her, so the cross frequency is f_i × f_j / (sum of allowed f_k). Every female with an allowed partner present leaves offspring. Only a female with no allowed partner at all is left out.
Take Model 1 (A-carriers mate with A-carriers, aa with aa) at D = 0.04, H = 0.32, R = 0.64. The realised mating frequencies are aa×aa 0.6400, Aa×Aa 0.2844, AA×Aa 0.0356 (and 0.0356 for Aa×AA), AA×AA 0.0044. Under random mating aa×aa would be 0.64² = 0.4096. The aa females all find aa males, so the cross is more common than chance. The next generation is D′ = 0.1111, H′ = 0.1778 and R′ = 0.7111, and p stays at 0.2000.
Sterile: wasted matings
In the sterile variant mating is random, with cross frequency f_i × f_j for all nine ordered pairs, but a forbidden cross produces no offspring. The mating happens and is wasted.
Run the same Model 1 grid as sterile. A-carriers have frequency 0.36 and aa has 0.64, so A- × aa pairings take up 2 × 0.36 × 0.64 = 0.4608 of all matings, and 46% of matings are wasted. The surviving offspring come mostly from aa×aa. The next generation is D′ = 0.0742, H′ = 0.1187 and R′ = 0.8071.
Allele frequency now falls, because the fertile crosses are mostly aa×aa, which produce only a. In the forbidden variant of the same grid p stayed at 0.2000. Here it is 0.1335 in generation 1, 0.0374 in generation 2 and 0.0020 in generation 3. By generation 4 A is gone.
The same grid, wasted
Exercise
Switch the variant
Open the module with Model 1 loaded, Variant Forbidden, and run. Read the Realised Mating Frequencies table and Next Generation. Switch Variant to Sterile and run again.
What to expect. Forbidden gives aa×aa 0.6400 and D′, H′, R′ of 0.1111, 0.1778, 0.7111. Sterile shows all nine crosses, with 46% greyed out, and gives 0.0742, 0.1187, 0.8071. Step 4 of the walkthrough shows the sterile case.
Open the walkthrough step →Negative mating, sterile
Exercise
Forbidden and sterile can disagree
Load Model 3, set Gen 50 and run it as Forbidden, then as Sterile. Note D, H, R and p at generation 50.
What to expect. Forbidden: D 0.0000, H 0.5000, R 0.5000, p 0.2500. Sterile: D 0.0280, H 0.5239, R 0.4481, p 0.2900. The same grid gives two different populations. Step 6 of the walkthrough compares the two.
Open the walkthrough step →A damped oscillation
Summary
- The grid has six symmetric crosses; 14 of the 64 patterns are named models, and only those run.
- Forbidden: a cross that is not allowed never happens, and each female picks among allowed males. Model 1 gives aa×aa 0.6400 and p stays at 0.2000.
- Sterile: all crosses happen at random frequency and forbidden ones leave no offspring. The same Model 1 grid wastes 46% of matings and drives p from 0.2000 to 0.0000 in 4 generations.
- The variants can end in different places: Model 3 ends at p = 0.2500 when forbidden and p = 0.2900 when sterile.
- Model 10 shows a damped oscillation, H = 0.84, 0.58, 0.71, 0.645, settling at 0.6667 and p = 0.5000.