Tutorials › Introduction to Statistics › Null Hypotheses for Two-Way Tables

Chi-Square Tests of Independence and Homogeneity · Tutorial 825 of 996

Null Hypotheses for Two-Way Tables

Learn to match the study question to the right two-way-table hypotheses and state each null and alternative precisely in context.

Intermediate 9 min read

What You'll Learn

  • State independence hypotheses using the joint and marginal probabilities of two categorical variables.
  • State homogeneity hypotheses by comparing category distributions across populations or groups.
  • Express alternatives as the existence of an association or a difference, without inventing a direction.
  • Distinguish the hypotheses by the study question and sampling design.
  • Interpret hypotheses as claims about population probabilities, not the observed sample counts.
  • Recognize when a conclusion would describe association rather than causation.

Why the Hypotheses Matter

A two-way table organizes counts for two categorical variables, but the table alone does not tell you what question an analysis is meant to answer. A study might ask whether two characteristics are associated in one population, or whether the distribution of a response differs among several groups. These questions lead to different interpretations of the null hypothesis, even though both are expressed using probabilities for categories in a table.

For both questions, the hypotheses concern population probabilities. The observed counts are evidence about those probabilities; they are not themselves the hypotheses. A careful statement names the variables or groups, identifies the population claim being tested, and explains what pattern would contradict the null.

Hypotheses for Independence

Suppose one population is described by two categorical variables, \(X\) and \(Y\). Let \(X\) have categories \(1,\ldots,r\) and \(Y\) have categories \(1,\ldots,c\). Write \(P(X=i,Y=j)\) for the probability that a randomly selected member of the population falls in category \(i\) of \(X\) and category \(j\) of \(Y\).

Definition: The population variables \(X\) and \(Y\) are independent if, for every pair of categories \(i,j\), \(P(X=i,Y=j)=P(X=i)P(Y=j)\). The independence test uses this as its null hypothesis. Its alternative is that this equality fails for at least one pair of categories; in context, the variables are associated in the population.

The null does not claim that every sample will show identical category proportions within every row. Random samples vary. It claims that the population joint probabilities factor into the two marginal probabilities. The alternative is omnibus: it says that some aspect of the joint distribution does not follow that independence pattern. Unless the study question specifies a particular comparison in advance, the alternative does not say which categories will differ or in what direction.

Worked Example: Are Two Health Behaviors Associated?

Imagine a hypothetical random sample of adults from one region. Each person is classified by whether they meet a weekly activity guideline (Yes or No) and by smoking status (Current smoker, Former smoker, or Never smoked). The question is whether guideline status and smoking status are associated among adults in that region.

Let \(X\) be guideline status and \(Y\) be smoking status. The population probabilities include terms such as \(P(X=\text{Yes},Y=\text{Current})\), \(P(X=\text{Yes})\), and \(P(Y=\text{Current})\).

Null hypothesis. State independence for every combination of categories: \(P(X=i,Y=j)=P(X=i)P(Y=j)\) for every guideline-status category \(i\) and smoking-status category \(j\). In words, guideline status and smoking status are independent among adults in this region.

Alternative hypothesis. For at least one combination \(i,j\), \(P(X=i,Y=j)\ne P(X=i)P(Y=j)\). In words, guideline status and smoking status are associated among adults in this region.

This alternative does not claim that smoking causes activity status, or that any particular smoking category has a higher probability of meeting the guideline. It describes a departure from independence, not its cause or direction.

Hypotheses for Homogeneity

A homogeneity question compares the distribution of one categorical response across two or more populations or groups. Let \(G\) denote group, with \(g=1,\ldots,k\), and let \(Y\) be a categorical response with categories \(1,\ldots,c\). Define \(q_{gj}=P(Y=j\mid G=g)\), the probability of response category \(j\) in group \(g\).

Definition: The response distribution is homogeneous across groups if \(q_{1j}=q_{2j}=\cdots=q_{kj}\) for every response category \(j\). The homogeneity null hypothesis states that all group distributions are equal. Its alternative states that at least two group distributions differ, meaning that at least one response-category probability is not the same across all groups.

Because the probabilities within each group add to 1, a difference in one or more category probabilities represents a difference in the distribution. The alternative need not say that every group differs from every other group; it says that the distributions are not all identical. It also does not identify in advance which groups or response categories account for a difference.

Worked Example: Comparing Preference Distributions Across Clinics

Suppose, hypothetically, that separate random samples are taken from patients at three clinics. Each patient selects one of three appointment options: morning, afternoon, or evening. The research question is whether appointment-time preference has the same distribution at all three clinics.

Let \(G\) identify the clinic and \(Y\) identify the selected appointment time. For example, \(q_{1,\text{morning}}\) is the population probability that a patient from clinic 1 selects a morning appointment.

Null hypothesis. The three distributions are equal: \(q_{1j}=q_{2j}=q_{3j}\) for each \(j\in\{\text{morning},\text{afternoon},\text{evening}\}\). In words, appointment-time preference has the same distribution among patients at all three clinics.

Alternative hypothesis. The distributions are not all equal. Equivalently, there is at least one appointment-time category \(j\) for which the probabilities are not equal across all clinics. In context, appointment-time preference differs among at least some of the clinics.

The alternative does not assert that all three clinics have distinct distributions. For example, two clinics could have the same distribution while the third differs. The hypothesis concerns the overall comparison, not a specific pairwise comparison.

How the Two Null Hypotheses Are Related

Independence and homogeneity have a close mathematical connection, but they frame the population question differently. Independence asks whether two variables in one population are related. Homogeneity asks whether a response distribution is the same across groups. The study question and sampling design determine which description is appropriate.

The connection can be shown using conditional probabilities. For a category \(i\) with \(P(X=i)>0\), the definition of conditional probability gives \(P(Y=j\mid X=i)=P(X=i,Y=j)/P(X=i)\). Under independence, substituting the independence equation gives:

$$ P(Y=j\mid X=i) = \frac{P(X=i)P(Y=j)}{P(X=i)} = P(Y=j). $$

Thus, under independence, the distribution of \(Y\) is the same within each category of \(X\): conditioning on \(X=i\) does not change any of the probabilities for \(Y\). Conversely, if \(P(Y=j\mid X=i)=P(Y=j)\) for every \(j\) and every \(i\) with positive probability, multiplying both sides by \(P(X=i)\) gives \(P(X=i,Y=j)=P(X=i)P(Y=j)\). So equal conditional distributions across the categories of \(X\) are equivalent to independence, when the conditioning categories have positive probability.

This equivalence explains why the same table can often be described in either language. It does not mean the two study questions should be used interchangeably: the sampling plan and the question being asked determine whether the intended interpretation is independence or homogeneity.

Worked Example: Choosing the Hypothesis Language

Consider two hypothetical designs about transportation to campus and student year.

Design A: One random sample of students from a university is taken, and each student is classified by year (first-year, second-year, third-year, or fourth-year) and usual transportation mode (walk, bicycle, bus, or car). The question asks whether year and transportation mode are associated among university students.

There is one sampled population, and two categorical variables are recorded on each student. Use an independence formulation: \(H_0\) states that year and usual transportation mode are independent among university students; \(H_a\) states that they are associated.

Design B: Separate random samples are taken from students in each of the four years, and the response recorded is each student’s usual transportation mode. The question asks whether transportation-mode distributions are equal across years.

Here the question is explicitly about response distributions across groups. Use a homogeneity formulation: \(H_0\) states that the distribution of usual transportation mode is the same in all four year groups; \(H_a\) states that the distributions are not all the same.

The wording reflects the question rather than the appearance of the table: both designs can produce a table with year categories in rows and transportation categories in columns, but their hypotheses describe different sampling questions.

Writing Hypotheses Precisely

A useful way to draft hypotheses is to name the target population or groups first, then state the null pattern and the kind of departure represented by the alternative. Avoid writing only “no difference” or “there is a relationship”: those phrases do not identify what is being compared.

1
Identify the question.
Is the study asking whether two categorical variables are associated in one population, or whether one categorical response distribution is equal across groups?
2
Name the population quantities.
For independence, refer to the joint and marginal probabilities of the two variables. For homogeneity, refer to response-category probabilities within each group.
3
State the null and its complement.
Write the complete independence or equality claim, then state that the alternative is a departure for at least one category combination or group distribution.

For an omnibus alternative, “at least one” matters. If the alternative is phrased as though every row or every group must differ, it is stronger than the usual alternative and may be false even when the null is false. A clear alternative describes any departure from the full null claim without claiming to know which one will occur.

Common Mistakes and Why the Wording Matters

  • Making the hypotheses about the sample. “The sample proportions are equal” is not the population null. Sample proportions can differ by chance even when population probabilities satisfy the null.
  • Giving a directional claim without a specified question. “More patients at clinic 1 prefer morning appointments” is not the general alternative for a homogeneity test. The standard omnibus alternative is that the group distributions are not all equal.
  • Confusing association with causation. An independence alternative says that two variables are associated in the population. It does not establish that changing one variable would cause a change in the other.
  • Ignoring the study framing. A table’s row and column labels alone do not tell you whether the intended question is independence or homogeneity. Describe the population question being asked.
  • Writing an incomplete null. For homogeneity, “the groups are the same” is vague. Specify that the distribution of the named response is the same across the named groups.

Correct hypotheses give the eventual statistical conclusion a clear meaning. A rejection of an independence null supports evidence of an association between the named variables in the population under study. A rejection of a homogeneity null supports evidence that the response distribution is not identical across the groups. Neither conclusion, by itself, identifies which categories differ or explains why.

Check Your Understanding

For each question, identify the appropriate hypothesis framework and state what the alternative would mean in context.

  1. A single random sample of households is classified by region and by whether the household has home internet access. What is the independence null, and what would contradict it?
  2. Separate samples are drawn from four hospitals, and patients are classified by discharge destination. State the homogeneity null and alternative.
  3. Why is “the sample distributions are identical” not an appropriate population null hypothesis?
  4. In a homogeneity test with three groups, must the alternative say that all three group distributions differ? Explain.
  5. A finding of association between two characteristics in an observational sample is reported. Why does that statement not, on its own, establish causation?