VIEW THIS AS

Auto mode follows the Route Engine until you choose a viewpoint.

YOU ARE HERE

ROUTE CHECK

CONNECTED TO

WHAT NEXT

Use the canonical route for this room, or HELP if you are unsure.

Why Mathematics? | Cochran’s Q Matched Binary Outcomes, Blocks and Repeated Proportions

Three learners review open books together at a classroom table, with stacks of textbooks, stationery and a whiteboard in the bright room.

When the same people, devices or blocks are observed under three or more conditions, the resulting success percentages are correlated. Comparing them as if they came from unrelated groups throws away the matching and misstates uncertainty. Cochran’s Q test organises the binary outcomes into an N-by-k matrix, contrasts the k condition totals, and uses each row total to account for block difficulty. Mathematics matters because a compact quadratic statistic preserves the design: it recognises that a person who succeeds everywhere contributes different information from one whose outcome changes across conditions. Preserve the evidence trail: state the mathematical object, calculate a small case, verify the result independently, vary one assumption and explain the boundary. That predict–calculate–check–critique cycle builds numeracy and transferable problem-solving without promising intelligence, admission, income or employment from one method. For a fuller investigation, keep a computation log with the original input, every declared convention, the hand-worked result, the software result, a residual or reconstruction check, and one deliberately awkward case. Ask what information the method uses, what it discards, which assumption provides the guarantee, and which quantity measures failure. Repeat after changing scale, precision or one parameter. A student should explain why the output moved, not merely observe that it changed. Parents and educators can support this by valuing clear diagrams, labelled units, honest uncertainty and corrected reasoning as much as speed.

Quick navigation: Why this mathematics matters · How the mechanism works · Worked example and core equations · Four deeper ideas · Twelve practical investigations · Limits and misconceptions · A learning route for students · Guidance for parents and educators · Frequently asked questions · Useful next reading and sources


Why this mathematics matters

Mathematics is important here because the useful result is not merely a picture or a fast answer. It is a chain of reasons: a representation records selected information; an equation transforms it; an invariant explains what survives; and a limit states where the conclusion may fail. Students who can narrate that chain are learning transferable problem-solving skills, not only specialist vocabulary.

The search intent behind ‘why mathematics is important’ is often practical: where do algebra, geometry, probability and numerical reasoning actually earn their place? This mechanism gives a concrete answer. It turns a large task into smaller checkable operations, and it lets a learner distinguish a theorem, an implementation convention, a measured result and an interpretation.

Did You Know? The foundational source is Cochran’s 1950 Biometrika paper on matched percentages. A current implementation reference is statsmodels’ current cochran_q documentation. Reading both prevents a common mistake: attributing every modern feature to the original publication or assuming software defaults are universal mathematics.


How the mechanism works

Arrange N matched units in rows and k conditions in columns, entering 1 for success and 0 for failure. Compute each column total C_j, each row total R_i and the grand total T. The numerator measures how unequal the column totals are; the denominator measures how much within-row variation is available after matching. Rows containing all zeros or all ones provide no evidence about which condition differs because they never change, although they remain visible in the bookkeeping. Under the null that every condition has the same success probability, the statistic is approximately chi-square with k-1 degrees of freedom. For k=2 the logic reduces to McNemar’s matched-pair comparison.

A common formula is Q=(k-1)[kΣ_j C_j²-T²]/[kT-Σ_i R_i²]. The denominator can also be written as Σ_i R_i(k-R_i), showing directly that a row with R_i=0 or R_i=k contributes zero discordant information. The null is p_1=p_2=…=p_k for matched binary responses. statsmodels describes Q as a k-sample extension of McNemar’s test and returns a chi-square p-value with k-1 degrees of freedom, while warning that the approximation requires a sufficiently large N. The test is omnibus: rejection says not all matched proportions are equal, not which pair differs.

A useful four-column notebook for this topic is object, rule, guarantee, caveat. In the first column, name what the algorithm receives and stores. In the second, write one operation without skipping its conditions. In the third, state exactly what the mathematics guarantees. In the fourth, record a boundary case, approximation or modelling choice. This small routine makes advanced mathematics readable because it keeps symbols attached to meaning.


Worked example and core equations

Use eight matched units across three conditions with rows [1,1,0], [1,0,0], [1,1,0], [1,1,0], [1,0,0], [1,1,1], [0,0,0], [1,0,0]. Column totals are C=[7,4,1], row totals are R=[2,1,2,2,1,3,0,1], T=12 and k=3. Then ΣC_j²=66 and ΣR_i²=24, so Q=2(3×66-12²)/(3×12-24)=2(54)/12=9. With 2 degrees of freedom, the chi-square p-value is about 0.011109. This supports an overall difference among condition probabilities under the approximation. It does not justify saying condition 1 beats every other condition until planned matched pairwise follow-ups and effect sizes are examined.

How to audit the calculation

  • Recompute each intermediate value from the definition before relying on a shortcut.
  • Keep indices, coordinate order, units and normalisation visible.
  • Test one case with a known exact answer.
  • Name any random choice, tolerance or boundary convention.
  • Compare with a slower reference calculation whenever possible.
  • Separate numerical agreement from proof that the real-world model is appropriate.

The worked numbers are deliberately small. A hand calculation can expose a sign error, reversed convention or missing scale factor before thousands of values make the same error harder to see. After the tiny case succeeds, increase size gradually and measure both accuracy and computational work.


Four deeper ideas

Matching removes stable row difficulty

Some units are likely to succeed under every condition and others under none. By retaining rows, the test compares conditions within the same block rather than confusing condition effects with permanent unit differences. This is the same design principle behind blocking in experiments: explain predictable variation before assessing the contrast of interest.

Only changers distinguish conditions

The denominator ΣR_i(k-R_i) is zero for all-failure and all-success rows. Such rows help describe prevalence but contain no within-row contrast. Rows with a mixture of zeros and ones determine which condition totals can separate. This is an important lesson about information: a large dataset can still contain few informative transitions.

An omnibus test protects the first question

Testing all pairs immediately multiplies opportunities for a chance finding. Cochran’s Q begins with the global equality question using k-1 degrees of freedom. If that question rejects, preplanned or multiplicity-adjusted matched comparisons can localise differences. The sequence keeps the interpretation aligned with the research plan.

Binary coding hides timing and severity

A 0/1 outcome is clear but coarse. It may discard how quickly success occurred, how severe a failure was or whether thresholds were close. The test is mathematically correct for the binary question while still being scientifically incomplete if the original measurement contains meaningful ordered or continuous information.


Twelve practical investigations

1. Three Teaching Formats

The same pupils answer equivalent binary mastery checks after three formats. Randomise or counterbalance order, form one row per pupil and test the global matched proportions.

What the mathematics reveals: Blocking controls stable pupil difficulty. Ask the learner to show the precise equation, inequality, index rule or invariant that supports this conclusion, then check it on one small example.

Limit to keep visible: Practice, carryover and non-equivalent questions can confound conditions. This boundary belongs beside the result so the example remains useful rather than overstated.

2. Diagnostic Devices

Each specimen is tested by four devices with positive or negative output. Use each specimen as a row and pair Q with device-specific sensitivity or agreement summaries.

What the mathematics reveals: The comparison preserves specimen matching. Ask the learner to show the precise equation, inequality, index rule or invariant that supports this conclusion, then check it on one small example.

Limit to keep visible: A reference standard and spectrum bias remain separate issues. This boundary belongs beside the result so the example remains useful rather than overstated.

3. Website Variants

The same panel completes a binary task under three interface variants. Counterbalance exposure and analyse one complete matched row per participant.

What the mathematics reveals: Within-person comparison can reduce between-person heterogeneity. Ask the learner to show the precise equation, inequality, index rule or invariant that supports this conclusion, then check it on one small example.

Limit to keep visible: Learning and fatigue violate a simple condition-only interpretation. This boundary belongs beside the result so the example remains useful rather than overstated.

4. Manual Calculation

Eight rows and three columns yield totals C=[7,4,1]. Recompute row totals, grand total, numerator and denominator before using software.

What the mathematics reveals: The formula exposes where the evidence comes from. Ask the learner to show the precise equation, inequality, index rule or invariant that supports this conclusion, then check it on one small example.

Limit to keep visible: A single transposed entry changes two totals and the result. This boundary belongs beside the result so the example remains useful rather than overstated.

5. All-Zero Rows

Several participants fail every condition. Keep them in descriptive reporting and show that R_i(k-R_i)=0 in the Q denominator.

What the mathematics reveals: No within-row change means no evidence about relative condition success. Ask the learner to show the precise equation, inequality, index rule or invariant that supports this conclusion, then check it on one small example.

Limit to keep visible: Removing them can misrepresent the study population. This boundary belongs beside the result so the example remains useful rather than overstated.

6. Missing Condition

One participant lacks the third measurement. Declare a complete-case or model-based strategy and analyse why data are missing.

What the mathematics reveals: A rectangular matched matrix is part of the classical calculation. Ask the learner to show the precise equation, inequality, index rule or invariant that supports this conclusion, then check it on one small example.

Limit to keep visible: Pairwise deletion silently changes the population across contrasts. This boundary belongs beside the result so the example remains useful rather than overstated.

7. Small Sample

Only ten matched units show very few changes. Use an exact or resampling method supported for the design, or report the limitation plainly.

What the mathematics reveals: Approximation quality depends on information, not just the formula. Ask the learner to show the precise equation, inequality, index rule or invariant that supports this conclusion, then check it on one small example.

Limit to keep visible: An unsupported exact label is worse than an honest limitation. This boundary belongs beside the result so the example remains useful rather than overstated.

8. Post-Hoc Pairs

The global test rejects across four treatments. Run preplanned McNemar comparisons with multiplicity control and matched effect estimates.

What the mathematics reveals: Global and local questions have different error rates. Ask the learner to show the precise equation, inequality, index rule or invariant that supports this conclusion, then check it on one small example.

Limit to keep visible: Choosing only visually extreme pairs exaggerates evidence. This boundary belongs beside the result so the example remains useful rather than overstated.

9. Order Effect

Every participant receives conditions A, B and C in that sequence. Model or redesign for period and carryover rather than attributing all differences to condition.

What the mathematics reveals: Matching alone does not remove systematic time order. Ask the learner to show the precise equation, inequality, index rule or invariant that supports this conclusion, then check it on one small example.

Limit to keep visible: A Q test cannot identify the source of an order-confounded difference. This boundary belongs beside the result so the example remains useful rather than overstated.

10. Threshold Choice

A continuous score is converted to pass or fail. Justify the threshold before analysis and compare what information is lost.

What the mathematics reveals: Binary proportions answer a clear but narrower question. Ask the learner to show the precise equation, inequality, index rule or invariant that supports this conclusion, then check it on one small example.

Limit to keep visible: Moving the cutoff after seeing results is outcome manipulation. This boundary belongs beside the result so the example remains useful rather than overstated.

11. Independent Groups Error

Different pupils receive each of three conditions. Use an independent-samples proportion method instead of Cochran’s Q.

What the mathematics reveals: The table layout must match the dependence structure. Ask the learner to show the precise equation, inequality, index rule or invariant that supports this conclusion, then check it on one small example.

Limit to keep visible: Inventing matches to force the method is invalid. This boundary belongs beside the result so the example remains useful rather than overstated.

12. Effect Reporting

Q is significant in a large study. Report each matched proportion, pairwise risk differences and compatible uncertainty intervals.

What the mathematics reveals: Decision evidence should be accompanied by magnitude. Ask the learner to show the precise equation, inequality, index rule or invariant that supports this conclusion, then check it on one small example.

Limit to keep visible: A global p-value alone does not support a practical recommendation. This boundary belongs beside the result so the example remains useful rather than overstated.


Limits and misconceptions

Rows must represent matched or blocked units and columns the same conditions; missing entries require a justified method rather than silently dropping different subsets per comparison. The outcome must be meaningfully binary. The common chi-square calibration can be poor with small N or sparse discordance, as current statsmodels documentation notes by requiring N to be large. The test assumes blocks are independent of one another even though measurements within a block are dependent. Rejection is global and needs careful follow-up. It does not estimate causal effects unless the condition assignment and study design justify causality, and it does not handle carryover, period effects or time trends in repeated-condition studies without further modelling.

Five misconceptions to challenge

  • It compares independent percentages: No. Its purpose is matched or blocked binary data; independence is across rows, not across columns within a row.
  • Every row contributes equally: No. Rows with identical outcomes across all conditions provide no within-row contrast.
  • A significant Q names the best condition: No. It only rejects equality across all conditions.
  • It is the same as Cochran–Mantel–Haenszel: No. The names share Cochran, but the designs, tables and hypotheses are different.
  • More than two conditions makes McNemar invalid but pairwise use harmless: Unplanned pairwise testing creates multiplicity and should be governed by a declared follow-up strategy.

Another broad misconception is that advanced mathematics automatically creates intelligence, admission, income or employment. It does not. Learning it can strengthen modelling, abstraction, calculation and explanation when practice is deliberate, but opportunities also depend on interests, communication, domain knowledge, education pathways and many circumstances outside one topic. Keep claims specific and options open.


A learning route for students

Move from a visible trace to a symbolic rule, then to code and critique. For every step below, prepare three pieces of evidence: a correct hand example, a boundary or failure case, and a short explanation using the relevant invariant. Do not advance merely because a library returned a number.

Step 1: Lay out matched binary data as an n-by-k matrix

Start with the smallest non-trivial instance. Predict the result, perform the calculation, and compare it with a reference. Change one assumption—size, spacing, sign, threshold, tolerance or data distribution—and explain which part of the reasoning changes. Finally, teach the step without code. That predict–calculate–vary–explain cycle is a strong test of transferable understanding.

Step 2: Calculate column totals row totals and t

Start with the smallest non-trivial instance. Predict the result, perform the calculation, and compare it with a reference. Change one assumption—size, spacing, sign, threshold, tolerance or data distribution—and explain which part of the reasoning changes. Finally, teach the step without code. That predict–calculate–vary–explain cycle is a strong test of transferable understanding.

Step 3: Derive the denominator from discordant rows

Start with the smallest non-trivial instance. Predict the result, perform the calculation, and compare it with a reference. Change one assumption—size, spacing, sign, threshold, tolerance or data distribution—and explain which part of the reasoning changes. Finally, teach the step without code. That predict–calculate–vary–explain cycle is a strong test of transferable understanding.

Step 4: Compute cochran’s q by hand

Start with the smallest non-trivial instance. Predict the result, perform the calculation, and compare it with a reference. Change one assumption—size, spacing, sign, threshold, tolerance or data distribution—and explain which part of the reasoning changes. Finally, teach the step without code. That predict–calculate–vary–explain cycle is a strong test of transferable understanding.

Step 5: Identify k-1 degrees of freedom

Start with the smallest non-trivial instance. Predict the result, perform the calculation, and compare it with a reference. Change one assumption—size, spacing, sign, threshold, tolerance or data distribution—and explain which part of the reasoning changes. Finally, teach the step without code. That predict–calculate–vary–explain cycle is a strong test of transferable understanding.

Step 6: Distinguish row and column independence

Start with the smallest non-trivial instance. Predict the result, perform the calculation, and compare it with a reference. Change one assumption—size, spacing, sign, threshold, tolerance or data distribution—and explain which part of the reasoning changes. Finally, teach the step without code. That predict–calculate–vary–explain cycle is a strong test of transferable understanding.

Step 7: Explain why constant rows are uninformative for contrasts

Start with the smallest non-trivial instance. Predict the result, perform the calculation, and compare it with a reference. Change one assumption—size, spacing, sign, threshold, tolerance or data distribution—and explain which part of the reasoning changes. Finally, teach the step without code. That predict–calculate–vary–explain cycle is a strong test of transferable understanding.

Step 8: Plan multiplicity-aware matched follow-ups

Start with the smallest non-trivial instance. Predict the result, perform the calculation, and compare it with a reference. Change one assumption—size, spacing, sign, threshold, tolerance or data distribution—and explain which part of the reasoning changes. Finally, teach the step without code. That predict–calculate–vary–explain cycle is a strong test of transferable understanding.

Step 9: Recognise missingness and order effects

Start with the smallest non-trivial instance. Predict the result, perform the calculation, and compare it with a reference. Change one assumption—size, spacing, sign, threshold, tolerance or data distribution—and explain which part of the reasoning changes. Finally, teach the step without code. That predict–calculate–vary–explain cycle is a strong test of transferable understanding.

Step 10: Report matched proportion differences with uncertainty

Start with the smallest non-trivial instance. Predict the result, perform the calculation, and compare it with a reference. Change one assumption—size, spacing, sign, threshold, tolerance or data distribution—and explain which part of the reasoning changes. Finally, teach the step without code. That predict–calculate–vary–explain cycle is a strong test of transferable understanding.

A four-week practice plan

  • Week 1 — vocabulary and diagrams: define each object, redraw the core mechanism and reproduce the worked example.
  • Week 2 — equations and manufactured tests: derive the key relation and test inputs with known answers.
  • Week 3 — implementation and evidence: use a trusted library, record parameters and compare with a transparent baseline.
  • Week 4 — transfer and critique: apply the mechanism to a new context, report limits and identify when a simpler or different method is better.

Guidance for parents and educators

Ask ‘what stays true?’ and ‘what could make this conclusion fail?’ before asking for speed. Invite the student to draw the input and output, label units, estimate the answer and locate the first step that disagrees with a reference. These prompts reveal conceptual understanding more clearly than memorised terminology.

Advanced enrichment should sit beside secure school foundations in algebra, functions, geometry, statistics and computational thinking. It need not accelerate a student into a fixed career identity. A healthy goal is curiosity with discipline: the learner becomes comfortable reading unfamiliar notation, checking an example, revising a model and communicating uncertainty.

Evidence prompts for a useful conversation

  • Which quantity is observed and which is inferred?
  • Which step saves work, and why is it allowed?
  • Is the claim exact, approximate, probabilistic or empirical?
  • What units and conventions are in use?
  • Which input makes the method struggle?
  • What simple baseline could check the answer?
  • What would count as evidence that the chosen parameters are poor?

Mini-project assessment

A strong mini-project contains the original question, a small reproducible dataset, a hand-worked example, code or a spreadsheet trace, at least one boundary test, a comparison with a baseline, and a paragraph on limits. Assess the reasoning trail as well as the final output. If a student can explain why a surprising result appeared and repair the model, that is valuable mathematical progress even when the first attempt was wrong.

Ten evidence checks

Check 1: Lay out matched binary data as an n-by-k matrix

Prepare a one-page evidence card for this capability. Put the definition or formula at the top, a hand-worked example in the middle, and a deliberately awkward input at the bottom. Beside each line, state what would make the result wrong: a convention, unit, index, random choice, approximation or modelling assumption. Reproduce the answer with an independent baseline and explain any difference before moving on. The card is complete only when another learner can follow it without guessing hidden parameters.

Check 2: Calculate column totals row totals and t

Prepare a one-page evidence card for this capability. Put the definition or formula at the top, a hand-worked example in the middle, and a deliberately awkward input at the bottom. Beside each line, state what would make the result wrong: a convention, unit, index, random choice, approximation or modelling assumption. Reproduce the answer with an independent baseline and explain any difference before moving on. The card is complete only when another learner can follow it without guessing hidden parameters.

Check 3: Derive the denominator from discordant rows

Prepare a one-page evidence card for this capability. Put the definition or formula at the top, a hand-worked example in the middle, and a deliberately awkward input at the bottom. Beside each line, state what would make the result wrong: a convention, unit, index, random choice, approximation or modelling assumption. Reproduce the answer with an independent baseline and explain any difference before moving on. The card is complete only when another learner can follow it without guessing hidden parameters.

Check 4: Compute cochran’s q by hand

Prepare a one-page evidence card for this capability. Put the definition or formula at the top, a hand-worked example in the middle, and a deliberately awkward input at the bottom. Beside each line, state what would make the result wrong: a convention, unit, index, random choice, approximation or modelling assumption. Reproduce the answer with an independent baseline and explain any difference before moving on. The card is complete only when another learner can follow it without guessing hidden parameters.

Check 5: Identify k-1 degrees of freedom

Prepare a one-page evidence card for this capability. Put the definition or formula at the top, a hand-worked example in the middle, and a deliberately awkward input at the bottom. Beside each line, state what would make the result wrong: a convention, unit, index, random choice, approximation or modelling assumption. Reproduce the answer with an independent baseline and explain any difference before moving on. The card is complete only when another learner can follow it without guessing hidden parameters.

Check 6: Distinguish row and column independence

Prepare a one-page evidence card for this capability. Put the definition or formula at the top, a hand-worked example in the middle, and a deliberately awkward input at the bottom. Beside each line, state what would make the result wrong: a convention, unit, index, random choice, approximation or modelling assumption. Reproduce the answer with an independent baseline and explain any difference before moving on. The card is complete only when another learner can follow it without guessing hidden parameters.

Check 7: Explain why constant rows are uninformative for contrasts

Prepare a one-page evidence card for this capability. Put the definition or formula at the top, a hand-worked example in the middle, and a deliberately awkward input at the bottom. Beside each line, state what would make the result wrong: a convention, unit, index, random choice, approximation or modelling assumption. Reproduce the answer with an independent baseline and explain any difference before moving on. The card is complete only when another learner can follow it without guessing hidden parameters.

Check 8: Plan multiplicity-aware matched follow-ups

Prepare a one-page evidence card for this capability. Put the definition or formula at the top, a hand-worked example in the middle, and a deliberately awkward input at the bottom. Beside each line, state what would make the result wrong: a convention, unit, index, random choice, approximation or modelling assumption. Reproduce the answer with an independent baseline and explain any difference before moving on. The card is complete only when another learner can follow it without guessing hidden parameters.

Check 9: Recognise missingness and order effects

Prepare a one-page evidence card for this capability. Put the definition or formula at the top, a hand-worked example in the middle, and a deliberately awkward input at the bottom. Beside each line, state what would make the result wrong: a convention, unit, index, random choice, approximation or modelling assumption. Reproduce the answer with an independent baseline and explain any difference before moving on. The card is complete only when another learner can follow it without guessing hidden parameters.

Check 10: Report matched proportion differences with uncertainty

Prepare a one-page evidence card for this capability. Put the definition or formula at the top, a hand-worked example in the middle, and a deliberately awkward input at the bottom. Beside each line, state what would make the result wrong: a convention, unit, index, random choice, approximation or modelling assumption. Reproduce the answer with an independent baseline and explain any difference before moving on. The card is complete only when another learner can follow it without guessing hidden parameters.


Frequently asked questions

What question does Cochran’s Q answer?

Whether three or more matched binary condition probabilities are all equal. State the relevant assumptions and parameters whenever the answer is used in a real calculation.

What is a block?

A person, specimen or other unit measured under every condition. State the relevant assumptions and parameters whenever the answer is used in a real calculation.

Why not use an ordinary chi-square independence test?

That would ignore the within-row correlation created by matching. State the relevant assumptions and parameters whenever the answer is used in a real calculation.

It is the k-condition extension; for two matched conditions the logic reduces to McNemar. State the relevant assumptions and parameters whenever the answer is used in a real calculation.

What are the degrees of freedom?

The usual chi-square reference uses k-1. State the relevant assumptions and parameters whenever the answer is used in a real calculation.

Do all-success rows matter?

They describe overall outcomes but provide no evidence about which condition differs within a row. State the relevant assumptions and parameters whenever the answer is used in a real calculation.

What if Q is significant?

Use a preplanned, multiplicity-aware matched follow-up and report effect sizes. State the relevant assumptions and parameters whenever the answer is used in a real calculation.

Can the design be causal?

Only if assignment, order and other study features justify causal interpretation; the test alone does not. State the relevant assumptions and parameters whenever the answer is used in a real calculation.

What should students know first?

Binary data, matched pairs, sums of squares, chi-square distributions and experimental blocking. State the relevant assumptions and parameters whenever the answer is used in a real calculation.

What broader lesson does it teach?

A statistical formula must preserve the structure that produced the observations. State the relevant assumptions and parameters whenever the answer is used in a real calculation.


Useful next reading and sources

Begin with Cochran’s 1950 Biometrika paper on matched percentages for the historical result and statsmodels’ current cochran_q documentation for a maintained modern interface or reference. Then connect the mechanism to these verified eduKateSG articles:

For the broader series, continue at eduKateSG Mathematics. Use primary sources for definitions and results, official documentation for present software behaviour, and experiments for performance on the actual task. Those evidence types support different claims and should not be merged casually.


Final takeaway

Why is mathematics important in this topic? Because it makes an invisible mechanism inspectable. Definitions say what the objects are. Equations show how information moves. Proof ideas explain what may safely be reused or approximated. Worked examples catch mistakes, while limits prevent a useful method from becoming an exaggerated promise. That combination of optimism and care is one of the lasting benefits of mathematics education.

Discover more from eduKate Singapore

Subscribe now to keep reading and get access to the full archive.

Continue reading