Learn

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Lesson 3 of 3

Calculate categorical evidence and identify its study design

Build expected counts and interpret chi-square tests as association or distribution comparisons according to sampling.

Loading your saved responses…

Try the optional starting-point checks and targeted refreshers. You can continue directly into this lesson.

Try

A synthetic random sample of 120 residents from a population exceeding 1200 records each person’s commute category and preferred opening schedule. The resulting two-by-three table has first row 30,20,10 and second row 15,25,20. Each person contributes once to exactly one cell. The null says the two categorical variables are independent in the represented population.

Now imagine the identical numbers came from independently taking a random sample of 60 residents in each of two districts, each with more than 600 residents, then recording one schedule preference. The numerical statistic would be the same, but the design question is homogeneity: whether the district populations share the same category distribution. Choose the study interpretation from recruitment, not from which label sounds more impressive.

Predict

Both row totals are 60. Column totals are 45,45,30. Under independence or equal distributions, predict the expected count in the first row’s third cell. It is not 10 just because that was observed. With half the sample in the first row and a quarter in the third column, the expected count is 120·(1/2)·(1/4)=15.

Predict whether chi-square should add signed discrepancies or squared standardized discrepancies. Positive and negative raw deviations cancel because the margins match; cancellation would hide the pattern the test is intended to detect.

Experiment

Calculate and audit a categorical table

Choose the method from the study design before entering numbers. Predict the direction of the effect, calculate, then explain whether the numerical reference is justified. Editing any input clears the previous result.

Enter one row per line and separate integer counts with spaces or commas. Use 2–10 rows and columns, equal row lengths, positive row/column totals and at most 1,000,000 observations. Do not enter percentages, margins or repeated responses as separate people.

The null states that the two categorical variables are independent in the population sampled. Changing this label changes the interpretation, not the table arithmetic or the actual collection design.

Temporary calculations do not save a response, award mastery or verify the design. Record the method, parameter, hypotheses, conditions, numerical results, units and contextual conclusion in your practice response. Public repetition is practice, not independent assessment.

Enter two rows of counts, using commas or spaces within each row and a new line between rows:

30,20,10
15,25,20

Choose independence for the single-sample, two-variable design. Calculate and inspect every expected cell before interpreting the reference probability.

CellObserved OExpected EContribution (O−E)²/E
Row 1, column 13022.52.5
Row 1, column 22022.50.2777778
Row 1, column 310151.6666667
Row 2, column 11522.52.5
Row 2, column 22522.50.2777778
Row 2, column 320151.6666667

The contributions sum to χ²=8.8888889. Degrees of freedom are (rows−1)(columns−1)=(2−1)(3−1)=2. The upper-tail probability is approximately 0.01174363. A chi-square discrepancy statistic is nonnegative; larger discrepancies supply evidence against the null, so the reference tail is upper, not a directional “greater category” hypothesis.

At a prespecified α=0.05, reject independence in the first study. State evidence of association, not proof that commute category causes preference. In the separately sampled district study, reject equal preference distributions. Switching the interpretation control should not change the numerical statistic for an unchanged table; it changes which population statement the design supports.

Understand

For row i and column j, expected count equals row total times column total divided by the grand total. This is the count implied by combining marginal proportions under the null. Pearson’s statistic sums (observed−expected)²/expected over every cell. Although expected counts may be nonintegers, observed entries here must be nonnegative whole counts of units.

All six expected counts in the worked example exceed 5, satisfying this workflow’s usual large-expected-count check. Also verify independent units, a defensible sampling or assignment mechanism, and a suitably small sampling fraction where observations are sampled without replacement. These checks do different jobs. A random-looking table cannot establish random recruitment, and a large total does not guarantee adequate expected counts in every cell.

When expected cells are sparse, the statistic can still be computed but its usual chi-square reference may be inappropriate. Consider an appropriate exact method or a revised data-collection plan. Do not merge categories solely to manufacture significance or to conceal a rare but substantively distinct outcome. If categories are combined for a defensible reason, explain the changed question.

Percentages are not substitute counts. Entering 60 and 40 from a 60%/40% report invents a sample size of 100 unless that was the actual denominator. Likewise, duplicating each record doubles the table but adds no independent evidence. The formal statistic would increase while its independence assumption failed. Ask what one row of the underlying dataset represents before trusting a small p-value.

The test is omnibus. Rejection means the entire independence or equal-distributions model is inconsistent with the evidence at the chosen threshold; it does not identify every differing category or population pair. Further comparisons require a plan that addresses multiplicity. Nonrejection is not proof of exact independence or practical equivalence.

Apply

Change the worked table to two rows 15,15,15 and 15,15,15. Predict its statistic before calculating. Then change to 5,0 and 0,5. Explain why the second table can look more dramatic while being less suitable for this reference approximation.

Compare numerical results with validity checks

In the equal-row table, every expected count is 15 and every contribution is zero. Thus χ²=0 and the chi-square upper-tail probability is 1. This is consistency with the null for these data, not proof that the null is true. In the small two-by-two table, every expected count is 2.5 and the statistic is 10. The sparse expected cells fail the usual approximation check; a displayed reference p-value is not a justified conclusion just because it is small. For an appropriate independent-unit two-by-two design, an exact conditional analysis is one possible alternative outside this workflow.

Before continuing, write a short report distinguishing an association test on one sampled population from a homogeneity test on separately sampled populations. Include the same numbers but different sampling descriptions so the distinction cannot be inferred from the table alone.

Continue

The earlier lessons on independence and homogeneity develop these null models. Here the practice requires an actual calculated reference probability, expected-cell audit and contextual conclusion. A calculator can evaluate a count table; it cannot certify that the counts came from the design described.

Apply · explain · revise

Practice and reasoning

Drafts save locally as you type. Reveal worked solutions when useful; the site remembers that exposure. Automatic matches check the requested answer, while written arguments require review against the rubric.

A random sample of 100 adults from a population exceeding 1000 is classified by commute mode (two rows) and preferred schedule (three columns). Counts are row 1:[24,16,10], row 2:[12,18,20]. Test independence at α=0.05. Show expected counts,df,statistic,p-value and scope.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Independent random samples of 60 users from each of two services give binary preference counts[35,25] and[20,40]. Test equal preference distributions at α=0.05 using Pearson chi-square without a continuity correction.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

A 2×2 count table is[5,0] and[0,5]. Audit the usual Pearson chi-square reference approximation. Explain why a large computed statistic would not cure the issue.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

A report gives groupA preferences as 60%/40% and groupB as 45%/55%, but omits sample sizes. Explain why entering[60,40] and[45,55] as observed counts is not justified. What information and design checks are needed?

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Three independent random samples each have 45 respondents in three categories, with rows[20,15,10],[10,20,15],[15,10,20]. Test homogeneity at α=0.05 and state what follow-up the omnibus result does not supply.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Compare the count table[24,16,10]/[12,18,20] with[48,32,20]/[24,36,40]. Calculate the second Pearson χ² and p-value. Explain why duplicating the original data rows does not create the independent new sample assumed by that calculation.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Reflect and continue

Before marking this lesson complete, explain one key idea without the worked solution and identify a condition that matters. Marking complete records participation, not independent mastery.