Why the Sampling Plan Matters
A two-way table organizes counts for two categorical variables. The table itself does not reveal how the observations were collected. Yet sampling determines the question the data can answer: whether two variables are related in one population, or whether a categorical response has the same distribution across populations or groups.
These questions are addressed by the chi-square test of independence and the chi-square test of homogeneity. Their calculations are closely related, but their study designs and interpretations differ. To distinguish them, ask first: Were both variables recorded on one sample, or was a separate sample taken from each group?
For example, a random sample of residents could be asked both whether they smoke and how many hours they usually sleep. That is one sample with two variables, so the design addresses independence. Alternatively, researchers could draw separate random samples of residents from several regions and record each person’s main mode of transportation. That is a homogeneity design: the response distribution is compared across regions.
One Sample, Two Variables: Independence
In an independence design, the sampling units come from one target population. Each unit contributes a pair of categorical observations, one for each variable. The two variables define the rows and columns of the two-way table; the categories of either variable are not selected in advance by taking separate samples.
The population question is whether knowing a unit’s category for one variable provides information about its category for the other. Formally, variables \(A\) and \(B\) are independent when, for every pair of categories \(a\) and \(b\) with \(P(A=a)>0\),
In words, the distribution of \(B\) is the same within every category of \(A\) as it is in the population overall. Independence does not mean that the observed counts in the table must be equal. Categories can have very different population frequencies while the two variables remain independent.
Worked Example: A Single Sample of Residents
Suppose a hypothetical city draws one random sample of 240 adult residents. Each resident reports smoking status and whether usual sleep is under 7 hours or at least 7 hours. The resulting table is:
| Under 7 hours | At least 7 hours | Total | |
|---|---|---|---|
| Smokes | 42 | 18 | 60 |
| Does not smoke | 90 | 90 | 180 |
| Total | 132 | 108 | 240 |
There is one sample of residents, and both categorical variables are recorded for each person. The design therefore addresses whether smoking status and usual sleep category are independent among adult residents of this city.
For a descriptive comparison, calculate the sample proportion sleeping under 7 hours within each smoking category:
In this hypothetical sample, 70.0% of residents who smoke reported under 7 hours of sleep, compared with 50.0% of residents who do not smoke. Those sample percentages describe the observed groups; they do not by themselves establish that the difference is more than sampling variation, or that smoking causes shorter sleep. The design is observational, not an experiment assigning smoking status.
Separate Samples, One Response: Homogeneity
In a homogeneity design, the group or source population is specified first, and a separate sample is drawn from each group. The same categorical response is recorded for each sampled unit. The question is whether the response-category proportions are the same across the groups.
A key feature is that the sample sizes for the groups are set by the sampling plan. Researchers might select 100 people from each of three regions, even if the regions have very different population sizes. The resulting table can compare response distributions across the sampled regions. However, the combined counts do not automatically estimate the response distribution for all residents of the regions combined; that would require sampling weights or a design that represents the combined population.
Worked Example: Comparing Transportation Across Regions
Suppose a hypothetical survey team independently selects 100 adult residents from each of three regions and records each person’s main mode of transportation. The counts are:
| Region | Walk | Bicycle | Public transit | Car | Total |
|---|---|---|---|---|---|
| North | 15 | 25 | 30 | 30 | 100 |
| Central | 10 | 15 | 35 | 40 | 100 |
| South | 20 | 10 | 20 | 50 | 100 |
These are separate samples selected by region, and transportation mode is the shared categorical response. This is a homogeneity design. For each region, the estimated category proportions are its counts divided by its sample size. For instance, the North sample’s public-transit proportion is
or 30.0%. The corresponding proportions are \(35/100=0.350\), or 35.0%, in the Central sample and \(20/100=0.200\), or 20.0%, in the South sample. These describe differences among the samples. The design’s inferential question is whether the transportation-mode distribution is the same across the three regional populations.
The group sample sizes are each 100 because the team chose to sample that many people from each region. Those totals do not indicate that the regions have equal population sizes. Nor do the counts alone establish that regional differences in transportation are caused by region; other characteristics could differ among residents.
Why the Two Questions Are Closely Related
The mathematical relationship between the two frameworks helps explain why both use two-way tables. Suppose one population is divided into categories of \(A\), and a categorical response \(B\) is recorded. If the distribution of \(B\) is identical within every category of \(A\), then \(A\) and \(B\) are independent. Conversely, if \(A\) and \(B\) are independent, the distribution of \(B\) must be identical across the categories of \(A\).
The reverse direction follows by averaging the conditional probabilities over all categories of \(A\). If \(P(B=b\mid A=a)=c\) for every \(a\) with positive probability, then:
Thus every conditional probability for \(B=b\) equals the overall probability \(P(B=b)\), which is the definition of independence. This equivalence concerns the population relationship. It does not erase the difference in sampling schemes: sampling one population and recording two variables is still distinct from taking separate samples from groups.
Sampling Fixes Different Margins
The sampling plan also determines which totals are set in advance. In a basic independence design, the total sample size is fixed, but the row and column totals arise from the sampled observations. A researcher does not control how many sampled residents smoke or how many report short sleep.
In a basic homogeneity design, the sample size from each group is fixed by design. The row totals for groups are therefore fixed, while the response-category counts within each group are observed outcomes. This distinction is useful when reading a table, but it does not mean that a fixed group sample size makes the table a different kind of data structure: both designs can produce the same arrangement of rows, columns, and counts.
Worked Example: Different Sampling Plans, Similar Tables
Consider a hypothetical comparison of satisfaction with appointment reminders at Clinic A and Clinic B. Clinic A patients are classified as satisfied or not satisfied; the same response is recorded for Clinic B patients.
| Clinic | Satisfied | Not satisfied | Total |
|---|---|---|---|
| Clinic A | 56 | 24 | 80 |
| Clinic B | 80 | 80 | 160 |
If a team independently sampled 80 patients from Clinic A and 160 from Clinic B, this is a homogeneity design. The satisfaction proportions are:
The samples estimate 70.0% satisfaction in Clinic A and 50.0% in Clinic B. The unequal row totals reflect the chosen sample sizes, not necessarily the relative numbers of patients at the clinics.
Now imagine instead that one random sample was drawn from a clearly defined population of patients, and each sampled patient’s clinic and satisfaction response were recorded. That would be a one-sample design with two categorical variables, addressing whether clinic and satisfaction are independent in that population. The counts might look similar, but the sampling scheme—and therefore the interpretation—would differ.
Pooling the satisfaction counts gives \(136/240=0.567\), or 56.7%, satisfied across the two samples. Under the separate-sample plan, this combined percentage depends on the decision to sample 80 people from one clinic and 160 from the other. It is not automatically an estimate of an overall satisfaction rate for all patients at both clinics.
Choosing the Design and Its Interpretation
Before interpreting a two-way table, write down how the observations entered it. A practical way to make the distinction is to identify what was sampled and what was measured:
Specify whether the sampled units came from one population or from separately sampled groups.
If two categorical variables are recorded for every unit in one sample, the design is for independence. If one categorical response is recorded in each of several separate samples, the design is for homogeneity.
Relate the result to the population or populations represented by the sampling plan. Do not treat sample composition as evidence about population sizes unless the design supports that conclusion.
For either design, generalizing beyond the observations depends on how the samples were selected and how well they represent the intended populations. A large sample chosen in a strongly biased way does not automatically represent its target population. If people appear in more than one row because they were measured repeatedly, or if observations are matched in pairs, the basic independent-samples framework may not apply without accounting for that structure.
Common Mistake: Classifying by Table Shape Alone
Wrong reasoning: “The table has groups in rows and response categories in columns, so it must be a test of homogeneity.” A table’s layout cannot tell you whether the rows were sampled separately or recorded as a variable within one sample.
Correction: Reconstruct the sampling plan. If one sample supplied both row and column classifications, the question is independence. If separate samples were deliberately drawn from the row groups and the same response was measured in each, the question is homogeneity. The same numerical table could arise under either plan, but its population interpretation would not be the same.
A related error is to interpret a difference between sample percentages as proof of a causal effect. In these categorical table designs, association or distributional differences do not alone establish cause and effect. A causal conclusion requires a design and assumptions that support it; a pattern in a two-way table by itself is not enough.
Check Your Understanding
For each situation, identify the design and state what population question the table can address.
- A random sample of library patrons reports both their age category and whether they borrow print or electronic books. Is this an independence or homogeneity design?
- Separate random samples are drawn from four hospitals, and each sampled patient reports whether they were satisfied with discharge instructions. What is being compared?
- A survey team intentionally selects 50 people from each of two neighborhoods. Why would the combined sample percentage not necessarily estimate the percentage for the two neighborhoods’ residents taken together?
- Explain why a table with “Clinic” as its row variable could come from either design.
- A researcher records the same response from each person at three visits and puts each visit in a separate table row. What feature of the observations should be checked before using a basic two-way-table framework?