Lesson 8 — Counting the ratios that breed true

Mendel's peas. Guess the ratio each cross should produce, count what actually comes up, then decide whether the gap between them is small enough to be luck.

Did Mendel have any idea about genes? Did he even know what part of the cell was inheritance? When he came up with dominant and recessive — these words you all are learning now in his rules — what did he know about molecular biology? Nothing. Literally nothing. He probably knows more than Mendel did about genetics. Now, Mendel was very smart. He set up really careful experiments. — 202_lec01_06

A — One gene, two alleles, a 3:1 ratio

Simulate Mendel's monohybrid cross. Slide the offspring count. Watch how close the observed ratio is to 3:1.

Locked — confirm your name above to begin.

Scenario

Two heterozygous pea plants (Aa × Aa). Each parent contributes one allele at random — Mendel's law of segregation. Three quarters of offspring should be dominant phenotype (AA or Aa); one quarter recessive (aa). The expected ratio is 3:1. The observed ratio is whatever you sample.

Observed counts vs expected 3:1

PhenotypeObservedExpected (3:1)(O−E)²/E
Dominant
Recessive
mismatch scoreP = —

Prediction

  1. Q1. With n = 40 offspring, the check against 3:1 will:
Try at least 5 (n, seed) combinations to unlock Stage B. 0/5 combos

Controls

40
42

R code — monohybrid cross

set.seed(42)n <- 40# Each offspring is dominant with prob 3/4 (Aa × Aa)offspring <- rbinom(1, n, 0.75)  # count dominant phenotypeobs <- c(dominant = offspring, recessive = n - offspring)exp <- c(dominant = n * 0.75, recessive = n * 0.25)chisq.test(obs, p = c(0.75, 0.25))

B — Two genes, independent assortment, a 9:3:3:1

Add a second locus. Four categories. Watch the check get pickier as n falls.

Complete Stage A to unlock this section.

Scenario

Two heterozygous loci, segregating independently. The four phenotype categories are expected at 9:3:3:1 — round-yellow : round-green : wrinkled-yellow : wrinkled-green. Same machinery as Stage A, now with four categories instead of two.

Observed counts vs expected 9:3:3:1

PhenotypeObservedExpected(O−E)²/E
Round, yellow
Round, green
Wrinkled, yellow
Wrinkled, green
mismatch scoreP = —

Prediction

  1. Q1. With n = 50 offspring across four categories, how often will the check flag 9:3:3:1 as off if the cross really is dihybrid?
Try at least 5 (n, seed) combinations to unlock Stage C. 0/5 combos

Controls

80
42

R code — dihybrid cross

set.seed(42)n <- 80p <- c(9, 3, 3, 1) / 16          # 9:3:3:1 expectedobs <- rmultinom(1, n, p)[,1]chisq.test(obs, p = p)

C — When a mismatch is real, and when it is just a small sample

Run many simulated crosses that all obey 3:1 exactly, and pile up how far each one's counts land from the ratio. Your one real experiment is a single draw from that pile.

Complete Stage B to unlock this section.

Scenario

Generate 1,000 simulated crosses, each with n offspring, every one built to follow 3:1 exactly. For each, measure how far its counts sit from the ratio, and stack those distances up. The 5% that miss by the most mark the far edge of the stack. Your one real experiment is a single draw from it.

how far honest 3:1 crosses miss the ratio

n / cross: 80  |  replicates: 1000  |  % beyond the 5% line: (theoretical: 5.0%)

Prediction

  1. Q1. Across 1,000 simulated 3:1 crosses, the fraction with misses beyond the 5% line will be:
Try at least 3 different n values to unlock Stage D. 0/3 values

Controls

80
42

R code — chance-spread of mismatches

set.seed(42)n <- 80reps <- 1000chi2 <- replicate(reps, {  d <- rbinom(1, n, 0.75)  o <- c(d, n - d); e <- c(0.75*n, 0.25*n)  sum((o - e)^2 / e)})mean(chi2 > 3.84)            # empirical rejection rate

D — Mendel's actual data — and Fisher's complaint

Mendel's published pea ratios fit 3:1 unusually well. So well, in fact, that his combined mismatch across crosses is in the lower 1% tail. Either his lab tech was lying, or he tossed crosses that didn't look right, or the universe was unusually kind. You decide.

Complete Stage C to unlock this section.

Scenario

Mendel's 1865 paper reports several monohybrid F2 ratios — round/wrinkled seed, yellow/green seed, etc. Load his counts. Compute mismatch for each trait. Then combine across traits. Where does Mendel's combined mismatch sit in the distribution of 1,000 simulated Mendel-style experimenters?

Mendel's combined mismatch vs simulated honest experimenters

Mendel's combined mismatch:  |  chance an honest lab misses by this little:

Per-trait breakdown

TraitnDominantRecessivemismatch scoreP

Prediction

  1. Q1. Combined across his published F2 ratios, Mendel's mismatch sits where in the distribution of honest experimenters' mismatch totals?
Run the simulated experimenter test at least 2 times to wrap up. 0/2 runs

Controls

42

R code — Mendel vs honest experimenters

peas <- read.csv("data/clean/mendel_pea.csv")# Per-trait chi-squaredchi_obs <- apply(peas, 1, function(r) {  o <- c(r["dominant"], r["recessive"])  n <- sum(o); e <- c(0.75*n, 0.25*n)  sum((o - e)^2 / e)})total_obs <- sum(chi_obs)# Simulate 1000 honest experimentersset.seed(42)null_totals <- replicate(1000, sum(apply(peas, 1, function(r) {  n <- r["dominant"] + r["recessive"]  d <- rbinom(1, n, 0.75)  o <- c(d, n - d); e <- c(0.75*n, 0.25*n)  sum((o - e)^2 / e)})))mean(null_totals <= total_obs)   # Fisher's complaint