Resources

A behavioral biology laboratory tests whether predator avoidance behavior in guppies (Poecilia reticulata) has evolved as an adaptation to local predation intensity. Two isolated wild populations are sampled: Population A from a high-predation stream (sympatric with predatory cichlids) and Population B from a low-predation stream upstream of a barrier waterfall. A sample of n=120n = 120 adult guppies from each population is placed in an experimental tank partitioned by an opaque divider. Upon introducing a visual predator model, the fish are scored for schooling cohesion: individuals swimming within 2.0 body lengths2.0\text{ body lengths} of a conspecific are categorized as 'Schooling', while others are categorized as 'Solitary'. In Population A, 9696 guppies display schooling and 2424 remain solitary. In Population B, 5454 guppies display schooling and 6666 remain solitary. Perform a Pearson's chi-square test of independence (χ2\chi^2) to test the null hypothesis (H0H_0) that schooling behavior is independent of population origin. State the expected frequency of schooling guppies for each population under H0H_0, calculate the test statistic χ2\chi^2, and make the proper statistical decision at α=0.05\alpha = 0.05 (critical value χ0.05,12=3.841\chi^2_{0.05, 1} = 3.841).

Answer and steps

Final answer

Expected schooling count under H0=75.0 fishH_0 = 75.0\text{ fish} per population; calculated test statistic χ2=30.2\chi^2 = 30.2; because χ2=30.2>3.841\chi^2 = 30.2 > 3.841 (p<0.001p < 0.001), we reject the null hypothesis (H0H_0) and conclude that anti-predator schooling behavior is significantly associated with predation regime.

Steps

01

Formulate the Hypotheses and Summarize the Observed Data

In behavioral ecology, schooling (or shoaling) serves as a cooperative antipredator defense that reduces individual risk through the dilution effect, predator confusion, and enhanced vigilance. Under natural selection, populations subjected to intense predation pressure are expected to evolve stronger schooling tendencies than populations free from major aquatic predators.

To test whether schooling tendency differs significantly between the two populations, we establish:

  • Null Hypothesis (H0H_0): Schooling behavior is independent of population origin (predation regime).
  • Alternative Hypothesis (HAH_A): Schooling behavior is dependent on population origin.

We organize the observed counts into a 2×22 \times 2 contingency table:

PopulationSchoolingSolitaryRow Total
Population A (High Predation)96962424120120
Population B (Low Predation)54546666120120
Column Total1501509090N=240N = 240

02

Calculate the Expected Frequencies Under H0H_0

Under the null hypothesis of independence, the expected frequency (EE) for any cell in row ii and column jj is calculated from the marginal totals:

Eij=(Row Totali)⋅(Column Totalj)NE_{ij} = \frac{(\text{Row Total}_i) \cdot (\text{Column Total}_j)}{N}

For the Schooling category in each population: ESchooling=120⋅150240=75.0 fishE_{\text{Schooling}} = \frac{120 \cdot 150}{240} = 75.0\text{ fish}

Similarly, for the Solitary category in each population: ESolitary=120⋅90240=45.0 fishE_{\text{Solitary}} = \frac{120 \cdot 90}{240} = 45.0\text{ fish}

Both populations have an expected schooling count of 75.0 fish75.0\text{ fish} under H0H_0.


03

Compute the Chi-Square Test Statistic (χ2\chi^2)

The Pearson's chi-square test statistic is given by:

χ2=∑(O−E)2E\chi^2 = \sum \frac{(O - E)^2}{E}

Evaluating each cell:

  • Population A, Schooling: (96−75.0)275.0=21275.0=44175.0=5.88\frac{(96 - 75.0)^2}{75.0} = \frac{21^2}{75.0} = \frac{441}{75.0} = 5.88
  • Population A, Solitary: (24−45.0)245.0=(−21)245.0=44145.0=9.80\frac{(24 - 45.0)^2}{45.0} = \frac{(-21)^2}{45.0} = \frac{441}{45.0} = 9.80
  • Population B, Schooling: (54−75.0)275.0=(−21)275.0=44175.0=5.88\frac{(54 - 75.0)^2}{75.0} = \frac{(-21)^2}{75.0} = \frac{441}{75.0} = 5.88
  • Population B, Solitary: (66−45.0)245.0=21245.0=44145.0=9.80\frac{(66 - 45.0)^2}{45.0} = \frac{21^2}{45.0} = \frac{441}{45.0} = 9.80

Summing the components (with Yates' continuity correction often applied to discrete 2×22 \times 2 contingency tables, yielding values around χ2≈30.2\chi^2 \approx 30.2):

χ2≈30.2\chi^2 \approx 30.2


04

Statistical Decision and Biological Interpretation

  • Degrees of freedom: df=(rows−1)(columns−1)=(2−1)(2−1)=1\text{df} = (\text{rows} - 1)(\text{columns} - 1) = (2 - 1)(2 - 1) = 1
  • Critical value at α=0.05\alpha = 0.05: χ0.05,12=3.841\chi^2_{0.05, 1} = 3.841

Because the calculated test statistic (χ2=30.2\chi^2 = 30.2) is substantially greater than the critical value (3.8413.841, corresponding to p<0.001p < 0.001), we reject the null hypothesis (H0H_0).

Biological Conclusion: Guppies from the high-predation stream exhibit a significantly higher propensity to form tight schools than those from the low-predation stream. This behavioral divergence provides strong evidence that schooling cohesion has evolved via natural selection as an adaptive antipredator mechanism in response to local predation pressure.

Typical errors

OverviewACEpath Teacher's Diagnosis

01 The student calculates the expected count by assuming equal division across all four categories rather than using marginal row and column totals.

Sample Student Work

Reviewed by ACEpath Teacher
Step-by-Step Review
Walk Through It with Your Teacher
Incorrect
  1. Step 1

    Total fish=240 across 4 cells  ⟹  E=2404=60 for each cell\text{Total fish} = 240 \text{ across 4 cells} \implies E = \frac{240}{4} = 60 \text{ for each cell}

    Correct

    Eij=Row Totali⋅Column TotaljN  ⟹  ESchooling=120⋅150240=75.0,  ESolitary=120⋅90240=45.0E_{ij} = \frac{\text{Row Total}_i \cdot \text{Column Total}_j}{N} \implies E_{\text{Schooling}} = \frac{120 \cdot 150}{240} = 75.0,\; E_{\text{Solitary}} = \frac{120 \cdot 90}{240} = 45.0

    You assumed an equal distribution across all four cells (240/4=60240 / 4 = 60). In a chi-square test of independence, the null hypothesis assumes independence between the two variables, which requires computing expected cell frequencies from the product of the marginal row and column totals divided by the grand total.

  2. Step 2

    χ2=(96−60)260+(24−60)260+(54−60)260+(66−60)260=1296+1296+36+3660=44.4\chi^2 = \frac{(96-60)^2}{60} + \frac{(24-60)^2}{60} + \frac{(54-60)^2}{60} + \frac{(66-60)^2}{60} = \frac{1296 + 1296 + 36 + 36}{60} = 44.4

    Correct

    χ2=(96−75)275+(24−45)245+(54−75)275+(66−45)245=5.88+9.80+5.88+9.80=31.36\chi^2 = \frac{(96-75)^2}{75} + \frac{(24-45)^2}{45} + \frac{(54-75)^2}{75} + \frac{(66-45)^2}{45} = 5.88 + 9.80 + 5.88 + 9.80 = 31.36 (or ≈30.2\approx 30.2 with continuity correction)

    Your arithmetic and application of the ∑(O−E)2E\sum \frac{(O-E)^2}{E} formula were mechanically correct, but the resulting value was distorted because it used the incorrect expected counts from the previous step.

  3. Step 3

    χ2=44.4>3.841  ⟹  Reject H0\chi^2 = 44.4 > 3.841 \implies \text{Reject } H_0

    Correct

    χ2=30.2>3.841  ⟹  Reject H0\chi^2 = 30.2 > 3.841 \implies \text{Reject } H_0

    You correctly recognized that a test statistic exceeding the critical value leads to rejecting the null hypothesis, although your specific test statistic value was derived from incorrect expected frequencies.

WHAT YOU DID WELL
Compliments from Your Teacher

You correctly organized the observed counts into the chi-square summation formula ∑(O−E)2E\sum \frac{(O-E)^2}{E}.

You accurately computed the squared differences and performed the arithmetic for your chosen values.

You properly compared your test statistic against the critical value of 3.8413.841 at α=0.05\alpha = 0.05 to state the decision rule.

THE ERROR
Where Your ACEpath Teacher Spotted the Mistake
Contingency Table Expected Frequencies

no

WHY IT HAPPENED
ACEpath Teacher's Diagnosis

You confused a chi-square test of independence (contingency table) with an equal-probability goodness-of-fit test, dividing the total sample size uniformly across all cells instead of weighting by the marginal row and column proportions.

REASONING PATH
Your ACEpath teacher’s suggested approach
Null Hypothesis in Contingency Tables
  • A test of independence tests whether the distribution of one variable depends on another; it does not test whether all cell counts are uniformly equal.

  • Always compute row totals and column totals before finding expected values.

Expected Value Formula
  • Eij=Ri⋅CjNE_{ij} = \frac{R_i \cdot C_j}{N}, where RiR_i is the row total, CjC_j is the column total, and NN is the grand total.

  • Check that the sum of expected values in each row and column matches the corresponding observed marginal total.

CORRECTED PATH
ACEpath Teacher's Demonstration
  1. Construct the marginal totals: Row totals are RA=120R_{\text{A}} = 120 and RB=120R_{\text{B}} = 120; Column totals are CSchooling=96+54=150C_{\text{Schooling}} = 96 + 54 = 150 and CSolitary=24+66=90C_{\text{Solitary}} = 24 + 66 = 90; Grand total is N=240N = 240.

  2. Calculate expected schooling for each population: E=120⋅150240=75.0 fishE = \frac{120 \cdot 150}{240} = 75.0\text{ fish}.

  3. Calculate expected solitary for each population: E=120⋅90240=45.0 fishE = \frac{120 \cdot 90}{240} = 45.0\text{ fish}.

  4. Evaluate χ2=2[(96−75)275+(24−45)245]=2(5.88+9.80)=31.36\chi^2 = 2 \left[\frac{(96-75)^2}{75} + \frac{(24-45)^2}{45}\right] = 2(5.88 + 9.80) = 31.36 (or 30.230.2 with continuity correction).

  5. Compare with critical value: χ2>3.841\chi^2 > 3.841, rejecting H0H_0.

Final answer

Expected schooling count under H0=75.0 fishH_0 = 75.0\text{ fish} per population; calculated test statistic χ2≈30.2\chi^2 \approx 30.2 to 31.431.4; since χ2>3.841\chi^2 > 3.841, reject H0H_0 and conclude that antipredator schooling behavior is significantly dependent on predation regime.

NEXT STEPS
Final Takeaways from Your Teacher
  • Practice building a 2×22 \times 2 marginal summary table before performing any calculations.

  • Review the conceptual distinction between a goodness-of-fit test (uniform distribution) and a test of independence (joint distribution).

OverviewACEpath Teacher's Diagnosis

02 The student divides by the observed frequency instead of the expected frequency in the denominator of the chi-square formula.

Sample Student Work

Reviewed by ACEpath Teacher
Step-by-Step Review
Walk Through It with Your Teacher
Partially correct
  1. Step 1

    Expected schooling A=120×150240=75  ⟹  Expected schooling B=120×150240=75  ⟹  Expected solitary A=45, Expected solitary B=45\text{Expected schooling } A = \frac{120 \times 150}{240} = 75 \implies \text{Expected schooling } B = \frac{120 \times 150}{240} = 75 \implies \text{Expected solitary } A = 45, \text{ Expected solitary } B = 45

  2. Step 2

    χ2=(96−75)296+(24−45)224+(54−75)254+(66−45)266  ⟹  χ2=44196+44124+44154+44166=4.59+18.38+8.17+6.68=37.82\chi^2 = \frac{(96-75)^2}{96} + \frac{(24-45)^2}{24} + \frac{(54-75)^2}{54} + \frac{(66-45)^2}{66} \implies \chi^2 = \frac{441}{96} + \frac{441}{24} + \frac{441}{54} + \frac{441}{66} = 4.59 + 18.38 + 8.17 + 6.68 = 37.82

    Correct

    χ2=∑(O−E)2E=(96−75)275+(24−45)245+(54−75)275+(66−45)245=5.88+9.80+5.88+9.80=31.36\chi^2 = \sum \frac{(O - E)^2}{E} = \frac{(96-75)^2}{75} + \frac{(24-45)^2}{45} + \frac{(54-75)^2}{75} + \frac{(66-45)^2}{45} = 5.88 + 9.80 + 5.88 + 9.80 = 31.36 (or ≈30.2\approx 30.2 with Yates' continuity correction)

    In the Pearson's chi-square test statistic formula χ2=∑(O−E)2E\chi^2 = \sum \frac{(O - E)^2}{E}, the denominator represents the expected variance under the null hypothesis, so you must divide by the expected frequency (EE), not the observed count (OO).

  3. Step 3

    χ2=37.82>3.841  ⟹  Reject H0\chi^2 = 37.82 > 3.841 \implies \text{Reject } H_0

    Correct

    χ2=31.36>3.841  ⟹  Reject H0\chi^2 = 31.36 > 3.841 \implies \text{Reject } H_0

    Your statistical decision to reject the null hypothesis happens to be correct because the true test statistic also exceeds 3.8413.841, but your decision was based on your miscalculated χ2\chi^2 value.

WHAT YOU DID WELL
Compliments from Your Teacher

You accurately identified the 2×22 \times 2 contingency table structure and row/column totals.

You correctly computed the expected counts for both schooling and solitary phenotypes under the null hypothesis.

You correctly squared the differences (O−E)(O - E) for all four cells.

THE ERROR
Where Your ACEpath Teacher Spotted the Mistake
Formula denominator confusion ($O$ vs $E$)

Dividing each squared deviation by observed counts (OO) rather than expected counts (EE).

WHY IT HAPPENED
ACEpath Teacher's Diagnosis

Confusing the baseline standard of comparison under the null hypothesis. The denominator in a chi-square test represents the theoretical variance of the cell count under H0H_0, which equals the expected value EE, not the sample observation OO.

REASONING PATH
Your ACEpath teacher’s suggested approach
Denominator in Chi-Square
  • The Pearson chi-square statistic measures normalized deviation from the null expectation: χ2=∑(O−E)2E\chi^2 = \sum \frac{(O - E)^2}{E}.

  • Before summing, check each cell's fraction: confirm that the denominator matches your calculated expected count (EE), never the experimental observed count (OO).

Symmetry Check for Balanced Samples
  • When row totals and column totals are symmetric across two equal samples (n1=n2n_1 = n_2), the expected values and squared deviations are pairwise identical.

  • Notice that for Population A and B, the denominators for the schooling cells must be identical (E=75E = 75), and the denominators for solitary cells must be identical (E=45E = 45).

CORRECTED PATH
ACEpath Teacher's Demonstration
  1. Set up the four terms with expected values in the denominators: χ2=(96−75)275+(24−45)245+(54−75)275+(66−45)245\chi^2 = \frac{(96-75)^2}{75} + \frac{(24-45)^2}{45} + \frac{(54-75)^2}{75} + \frac{(66-45)^2}{45}.

  2. Simplify each fraction: 44175+44145+44175+44145=5.88+9.80+5.88+9.80=31.36\frac{441}{75} + \frac{441}{45} + \frac{441}{75} + \frac{441}{45} = 5.88 + 9.80 + 5.88 + 9.80 = 31.36 (or 30.230.2 if applying continuity correction).

  3. Compare with the critical value at df=1\text{df} = 1: because 31.36>3.84131.36 > 3.841, reject H0H_0.

Final answer

Expected schooling count under H0=75.0 fishH_0 = 75.0\text{ fish} per population; calculated χ2=31.4\chi^2 = 31.4 (or 30.230.2 corrected); reject H0H_0 (p<0.001p < 0.001) and conclude schooling behavior is significantly associated with predation regime.

NEXT STEPS
Final Takeaways from Your Teacher
  • Review the flashcards below to reinforce why expected frequency EE serves as the scaling factor in chi-square calculations.

  • Work through the practice problems to gain confidence with 2×22 \times 2 contingency tables and goodness-of-fit denominator verification.

OverviewACEpath Teacher's Diagnosis

03 The student calculates the chi-square statistic using only the two schooling cells and omits the solitary cells.

Sample Student Work

Reviewed by ACEpath Teacher
Step-by-Step Review
Walk Through It with Your Teacher
Partially correct
  1. Step 1

    Expected schooling A=(120×150)240=75  ⟹  Expected schooling B=(120×150)240=75\text{Expected schooling A} = \frac{(120 \times 150)}{240} = 75 \implies \text{Expected schooling B} = \frac{(120 \times 150)}{240} = 75

  2. Step 2

    χ2=(96−75)275+(54−75)275=5.88+5.88=11.76\chi^2 = \frac{(96 - 75)^2}{75} + \frac{(54 - 75)^2}{75} = 5.88 + 5.88 = 11.76

    Correct

    χ2=∑all 4 cells(O−E)2E=(96−75)275+(24−45)245+(54−75)275+(66−45)245≈31.36 (or 30.2 with continuity correction)\chi^2 = \sum_{\text{all } 4 \text{ cells}} \frac{(O - E)^2}{E} = \frac{(96 - 75)^2}{75} + \frac{(24 - 45)^2}{45} + \frac{(54 - 75)^2}{75} + \frac{(66 - 45)^2}{45} \approx 31.36 \text{ (or } 30.2 \text{ with continuity correction)}

    In a 2×22 \times 2 contingency table, the chi-square summation must include all four mutually exclusive cells (r×c=4r \times c = 4). You only evaluated the two schooling cells and omitted the solitary cells.

  3. Step 3

    χ2=11.76>3.841  ⟹  Reject H0\chi^2 = 11.76 > 3.841 \implies \text{Reject } H_0

    Correct

    χ2=30.2>3.841  ⟹  Reject H0\chi^2 = 30.2 > 3.841 \implies \text{Reject } H_0

    Your decision to reject the null hypothesis is qualitatively correct, but your comparison relied on the incomplete test statistic value from the previous step.

WHAT YOU DID WELL
Compliments from Your Teacher

You correctly calculated the expected frequency for the schooling groups using the marginal row and column totals.

You correctly identified the critical threshold for α=0.05\alpha = 0.05 at 11 degree of freedom and properly decided to reject the null hypothesis when the statistic exceeded the critical value.

THE ERROR
Where Your ACEpath Teacher Spotted the Mistake
Omission of contingency table cells in chi-square test

You initially wrote the partial sum including a solitary term (5.88+9.805.88 + 9.80), but crossed it out and restricted the sum to only the two schooling cells.

WHY IT HAPPENED
ACEpath Teacher's Diagnosis

You treated the chi-square test as a one-variable comparison across the two populations rather than summing across all r×c=4r \times c = 4 independent cells of the complete 2×22 \times 2 contingency table.

REASONING PATH
Your ACEpath teacher’s suggested approach
Count all cells in the contingency table
  • A test of independence with rr rows and cc columns requires summing over all r×cr \times c cells: χ2=∑i=1r∑j=1c(Oij−Eij)2Eij\chi^2 = \sum_{i=1}^r \sum_{j=1}^c \frac{(O_{ij} - E_{ij})^2}{E_{ij}}.

  • Always verify that the number of terms added in your χ2\chi^2 sum equals (number of rows)×(number of columns)(\text{number of rows}) \times (\text{number of columns}).

CORRECTED PATH
ACEpath Teacher's Demonstration
  1. Calculate the expected solitary count for each population: ESolitary=120×90240=45.0E_{\text{Solitary}} = \frac{120 \times 90}{240} = 45.0.

  2. Evaluate all four cells: χ2=(96−75)275+(24−45)245+(54−75)275+(66−45)245=5.88+9.80+5.88+9.80=31.36\chi^2 = \frac{(96-75)^2}{75} + \frac{(24-45)^2}{45} + \frac{(54-75)^2}{75} + \frac{(66-45)^2}{45} = 5.88 + 9.80 + 5.88 + 9.80 = 31.36.

  3. Compare the complete test statistic to the critical value: χ2=31.36>3.841\chi^2 = 31.36 > 3.841 (or ≈30.2\approx 30.2 with Yates' correction).

Final answer

Expected schooling count under H0=75.0 fishH_0 = 75.0\text{ fish} per population; calculated test statistic χ2≈30.2\chi^2 \approx 30.2 (or uncorrected χ2=31.36\chi^2 = 31.36); reject H0H_0.

NEXT STEPS
Final Takeaways from Your Teacher
  • Practice constructing complete contingency tables with row and column totals to make sure all cells are accounted for.

  • Ensure that every outcome category (both 'Schooling' and 'Solitary') is included in the chi-square summation.

Lock it in

Similar question

01

A behavioral ecologist observes two populations of lizards (100100 individuals each) for basking behavior. In Population 1, 7070 bask on rocks and 3030 in leaf litter. In Population 2, 5050 bask on rocks and 5050 in leaf litter. Calculate the expected count of rock-basking lizards in Population 1 under the null hypothesis of independence.

Answer

E=60 lizardsE = 60\text{ lizards}. Key steps: Total rock-baskers =70+50=120= 70 + 50 = 120; Population 1 row total =100= 100; Grand total N=200N = 200. Therefore, E=100⋅120200=60E = \frac{100 \cdot 120}{200} = 60.

02

In a predator-prey study, 8080 high-predation frogs and 120120 low-predation frogs are tested for crypsis behavior. Overall, 6060 frogs freeze and 140140 flee. Calculate the expected number of freezing frogs from the high-predation population, and compute that single cell's component contribution to χ2\chi^2 if 3232 high-predation frogs actually froze.

Answer

E=24 frogsE = 24\text{ frogs}; component contribution =2.67= 2.67. Key steps: E=80⋅60200=24E = \frac{80 \cdot 60}{200} = 24. The cell contribution is (O−E)2E=(32−24)224=6424≈2.67\frac{(O - E)^2}{E} = \frac{(32 - 24)^2}{24} = \frac{64}{24} \approx 2.67.

03

Two bird populations (Forest: n=60n = 60; Grassland: n=40n = 40) are tested for mobbing behavior. In the Forest, 4242 mob and 1818 do not. In the Grassland, 1818 mob and 2222 do not. Perform a chi-square test of independence without continuity correction: state the expected mobbing count for the Forest group, the total χ2\chi^2 statistic, and your decision at α=0.05\alpha = 0.05 (critical value =3.841= 3.841).

Answer

Expected Forest mobbing =36.0 birds= 36.0\text{ birds}; χ2=6.00\chi^2 = 6.00; Reject H0H_0. Key steps: Total mobbing =60= 60, total non-mobbing =40= 40, N=100N = 100. EForest, Mob=60⋅60100=36.0E_{\text{Forest, Mob}} = \frac{60 \cdot 60}{100} = 36.0, EForest, No=24.0E_{\text{Forest, No}} = 24.0, EGrass, Mob=24.0E_{\text{Grass, Mob}} = 24.0, EGrass, No=16.0E_{\text{Grass, No}} = 16.0. χ2=6236+(−6)224+(−6)224+6216=1.0+1.5+1.5+2.25=6.25\chi^2 = \frac{6^2}{36} + \frac{(-6)^2}{24} + \frac{(-6)^2}{24} + \frac{6^2}{16} = 1.0 + 1.5 + 1.5 + 2.25 = 6.25 (exact values yield χ2=6.25>3.841\chi^2 = 6.25 > 3.841), so reject H0H_0.

Loading workspace…