Selection models (simple viability selection at one locus)
This calculator implements a classroom-ready viability selection model for a single genetic locus with two alleles
\(A\) and \(a\). Individuals are born with genotype frequencies (zygotes), then experience genotype-dependent survival
(fitness) before reproducing. The result is a new set of genotype frequencies among survivors and an updated allele
frequency \(p'\) for the next generation.
Alleles, genotype frequencies, and Hardy–Weinberg zygotes
Let \(p\) be the frequency of allele \(A\) and \(q\) the frequency of allele \(a\), so:
\[
\begin{aligned}
p + q &= 1
\end{aligned}
\]
Under random mating (Hardy–Weinberg zygotes), the pre-selection genotype frequencies are:
\[
\begin{aligned}
f_{AA} &= p^{2} \\
f_{Aa} &= 2pq \\
f_{aa} &= q^{2}
\end{aligned}
\]
If genotype frequencies are given directly (not necessarily Hardy–Weinberg), allele frequency is computed by allele counting:
\[
\begin{aligned}
p &= f_{AA} + \frac{1}{2}f_{Aa} \\
q &= 1 - p
\end{aligned}
\]
Fitness and viability selection
Assign each genotype a fitness (relative survival) between 0 and 1:
\(w_{AA}\), \(w_{Aa}\), \(w_{aa}\). Fitness values do not have to represent absolute survival; what matters is their
relative differences.
Mean fitness
The mean fitness \(\bar{w}\) is the average survival of the population, weighted by genotype frequencies:
\[
\begin{aligned}
\bar{w} &= f_{AA}\cdot w_{AA} + f_{Aa}\cdot w_{Aa} + f_{aa}\cdot w_{aa}
\end{aligned}
\]
This quantity is crucial because it provides the normalization needed to make post-selection frequencies sum to 1.
Post-selection genotype frequencies
After selection, each genotype’s frequency among survivors is proportional to its original frequency times its fitness:
\[
\begin{aligned}
f'_{AA} &= \frac{f_{AA}\cdot w_{AA}}{\bar{w}} \\
f'_{Aa} &= \frac{f_{Aa}\cdot w_{Aa}}{\bar{w}} \\
f'_{aa} &= \frac{f_{aa}\cdot w_{aa}}{\bar{w}}
\end{aligned}
\]
These satisfy \(f'_{AA} + f'_{Aa} + f'_{aa} = 1\).
Updated allele frequencies after selection
Allele frequencies among survivors follow from allele counting:
\[
\begin{aligned}
p' &= f'_{AA} + \frac{1}{2}f'_{Aa} \\
q' &= 1 - p'
\end{aligned}
\]
Selection coefficient s and dominance h (advanced input)
A common parameterization uses a selection coefficient \(s\) (strength of selection against \(aa\)) and a dominance
parameter \(h\) (how much of that disadvantage is expressed in heterozygotes). In this form:
\[
\begin{aligned}
w_{AA} &= 1 \\
w_{Aa} &= 1 - h s \\
w_{aa} &= 1 - s
\end{aligned}
\]
Interpretation:
\(s = 0\) means no selection; larger \(s\) means stronger selection against \(aa\).
If \(h = 0\), the disadvantage is recessive (only \(aa\) is selected against).
If \(h = 1\), the disadvantage is dominant (both \(AA\) and \(Aa\) are reduced relative to the baseline).
Multi-generation iteration (trajectory of p)
If the calculator simulates multiple generations, it repeats the selection update each generation. A standard
classroom assumption is that random mating produces Hardy–Weinberg zygotes from the updated allele frequency.
Conceptually:
\[
\begin{aligned}
p(t) &\rightarrow \left(f_{AA}(t), f_{Aa}(t), f_{aa}(t)\right) \rightarrow p'(t) \\
p(t+1) &= p'(t)
\end{aligned}
\]
The line chart of \(p\) vs generation visualizes how allele frequencies change under the chosen fitness scheme.
Common classroom scenarios
The presets represent typical qualitative patterns:
selection against recessive (lower \(w_{aa}\)),
heterozygote advantage ( \(w_{Aa}\) highest ),
and dominant selection (heterozygotes share much of the disadvantage).
The calculator displays both the “before vs after” genotype bars and the \(p\) trajectory to connect the algebra to intuition.