Tutorials › VEE Mathematical Statistics › Independent-Sample Questions for the Rank-Sum Test

VEE Mathematical Statistics · Sign and Wilcoxon Tests · Tutorial 846 of 880

Independent-Sample Questions for the Rank-Sum Test

Learn to recognize independent two-sample settings for the rank-sum test and state precisely what its null hypothesis says.

Intermediate 12 min read

What You'll Learn

  • Identify a two-group location question and its outcome variable.
  • Check independence within each group as well as independence between groups.
  • Distinguish independent samples from paired, repeated, and clustered observations.
  • State the rank-sum null as equality of the complete population distributions.
  • Explain when a rank-sum comparison can be interpreted as a location or median comparison.
  • Avoid treating equality of medians as equivalent to equality of distributions.

When Is a Rank-Sum Question an Independent-Sample Question?

Suppose a researcher compares an outcome between two groups: recovery time under two treatments, a laboratory measurement from two populations, or an ordinal rating from two independent panels. If the question concerns whether the groups have the same distribution, the Wilcoxon rank-sum test is a rank-based procedure to consider. Its first requirement is not a particular calculation. It is a study design that supplies two genuinely independent samples.

“Independent samples” requires more than saying that the groups have different names or contain different people. Observations must be independent within each group, and the two samples must be independent of one another. A sound random-sampling or random-assignment design can justify these conditions. If the same individuals are measured twice, if subjects are matched across groups, or if observations are clustered in dependent units, the ordinary two-sample rank-sum setup does not apply as stated.

Definition: An independent two-sample setting has two groups of observations such that, within each group, observations are independently sampled from that group’s population distribution, and the two sample vectors are independent of one another. A suitable randomization design may also justify the required independence. Write the observations as \(X_1,\ldots,X_{n_X}\) from distribution \(F_X\) and \(Y_1,\ldots,Y_{n_Y}\) from distribution \(F_Y\). The rank-sum test is a rank-based procedure for comparing these two distributions.

The outcome should be at least ordinal: its values must be meaningfully ordered so that observations can be ranked. The test does not require normally distributed outcomes. However, the distributional null it targets is stronger than the statement that two population medians are equal. That distinction matters whenever the groups may differ in spread or shape.

The Null Hypothesis Is Equality of Distributions

Let \(F_X(t)=P(X\leq t)\) and \(F_Y(t)=P(Y\leq t)\) denote the population cumulative distribution functions for the two groups. The usual null for the rank-sum test is that the entire population distributions are identical.

Null hypothesis: \(H_0:F_X(t)=F_Y(t)\) for every real number \(t\). Equivalently, an observation from either population has the same probability distribution under the null. A general two-sided alternative is \(H_1:F_X(t)\ne F_Y(t)\) for at least one value of \(t\).

Under \(H_0\), the groups do not differ in location, spread, or shape: their distributions agree altogether. The alternative allows any distributional difference, including a location difference, a spread difference, a shape difference, or a combination. Consequently, a rejection does not by itself establish that one group has a larger median.

A location interpretation needs an additional condition. A common model is that the distributions have the same shape and differ only by a shift. For example, one may suppose \(Y\) has the distribution of \(X+\theta\), where \(\theta\) is a constant. Under such a model, a difference between the distributions is attributable to location, and a median comparison can be meaningful. Without a same-shape location-shift assumption, a rank-sum result is about distributional differences, not just medians.

$$ H_0:F_X=F_Y \qquad\text{versus}\qquad H_1:F_X\ne F_Y $$

This null is not the same as \(H_0:\operatorname{median}(X)=\operatorname{median}(Y)\). Two distributions can have the same median but different spreads or shapes. Conversely, the rank-sum test is not a universal test for every possible difference between distributions: its sensitivity is especially connected to how the two groups’ observations compare in rank. The full test statistic and its reference distribution are separate calculation questions.

Why Independent Sampling Supports the Rank-Based Null

The reason independence is essential can be seen from the joint distribution. Under the null, suppose each of the \(n_X+n_Y\) observations is an independent draw from the same population distribution \(F\). For any particular assignment of \(n_X\) observations to the \(X\) group and the remaining \(n_Y\) to the \(Y\) group, the joint probability model is the same: every observation has distribution \(F\), and the joint distribution factors into the same product of individual distributions. Thus, conditional on the pooled observed values, the group labels have no systematic preference under \(H_0\).

This exchangeability of labels is the basic justification for rank-based comparisons under the identical-distribution null. If observations within a group are dependent, or if the two samples are dependent, the joint distribution need not factor in this way. Then the usual label-exchangeability argument fails, even if the two observed groups happen to have similar sample sizes or different subject names.

$$ H_0:\quad P(X_1\in A_1,\ldots,X_{n_X}\in A_{n_X}, Y_1\in B_1,\ldots,Y_{n_Y}\in B_{n_Y}) = \prod_{j=1}^{n_X}P_F(A_j) \prod_{k=1}^{n_Y}P_F(B_k) $$

Here each \(A_j\) and \(B_k\) is a set of possible outcome values, and \(P_F\) denotes probability under the common distribution \(F\). The product form expresses both within-group independence and independence between the two groups. It is not justified merely by observing that the measurements were recorded in separate columns.

Worked Examples: Identify the Design Before the Test

Worked Example: Two Independently Assigned Recovery Groups

Method: Check the outcome, the group structure, and the independence conditions before stating the distributional hypotheses. In a hypothetical randomized study, ten patients are individually assigned to one of two recovery programs, five to each. Their recovery times in days are:

Program A: \(4,5,7,6,8\). Program B: \(9,7,8,10,11\). Assume the assignment is conducted independently for patients, each patient contributes one outcome, and there are no shared household or other dependencies between patients. The research question is whether the population recovery-time distributions differ.

Step 1: Identify the outcome and groups. The outcome is recovery time in days, a quantitative ordered measurement. The groups are patients assigned to Program A and patients assigned to Program B. Each of the five observations in a group comes from a different patient.

Step 2: Check independence. Under the stated design assumptions, observations are independently obtained within each program group, and assignment and outcomes for the two groups are independent. The groups are not paired by patient, and there is no repeated measurement. Therefore this is an independent two-sample setting.

Step 3: State the null and alternative. If \(F_A\) and \(F_B\) are the population recovery-time distributions, use \(H_0:F_A(t)=F_B(t)\) for every \(t\), versus \(H_1:F_A(t)\ne F_B(t)\) for at least one \(t\). The rank-sum test is suitable for this distributional comparison.

Step 4: Check what the observed medians do and do not say. Program A’s sorted observations are \(4,5,6,7,8\), so its sample median is \(6\) days. Program B’s sorted observations are \(7,8,9,10,11\), so its sample median is \(9\) days. The observed median difference is \(9-6=3\) days. This describes these samples; it does not change the null into a test of population medians alone. A location-only interpretation would require a same-shape location-shift model.

Check: There are five observations per group, and both sorted lists contain five values, so the middle value is the third value in each list. Common mistake avoided: Equating the null of identical distributions with equality of population medians.

Worked Example: Repeated Measurements Are Not Independent Samples

Method: Trace each measurement back to the individual who produced it. A hypothetical clinic records a pain score for each of four patients before and after a new exercise plan. Scores are on a 0-to-20 scale, with lower scores indicating less pain.

Before: \(12,15,10,14\). After: \(10,13,9,12\). The entries in each position belong to the same patient.

Step 1: Identify the pairing. Patient 1 contributes the pair \(12,10\); Patient 2 contributes \(15,13\); Patient 3 contributes \(10,9\); Patient 4 contributes \(14,12\). The before and after observations are therefore linked within each patient.

Step 2: Calculate the paired changes. Define each change as after minus before. The four changes are \(10-12=-2\), \(13-15=-2\), \(9-10=-1\), and \(12-14=-2\), giving \(-2,-2,-1,-2\). The median change is \(-2\), since the ordered changes are \(-2,-2,-2,-1\) and the average of the two middle values is \((-2+-2)/2=-2\).

Step 3: Decide whether the independent-sample rank-sum setup applies. It does not. Although there are two columns of measurements, the before and after sample vectors are dependent because each pair comes from the same patient. The ordinary rank-sum null \(F_{\text{before}}=F_{\text{after}}\) with independent samples is not justified by this design. A paired procedure is appropriate; the sign and signed-rank procedures address paired differences under their respective assumptions.

Check: Four subjects produce four paired changes, not eight independent observations. Common mistake avoided: Treating two measurement occasions as independent groups merely because they have separate labels.

Worked Example: Equal Sample Medians Do Not Mean Equal Distributions

Method: Separate a question about the complete distributions from a question about location alone. A hypothetical study independently samples six customers from each of two service centers. Each customer gives an ordered satisfaction score. Assume customers are independently sampled within each center, the samples are independent across centers, and each customer contributes one score.

Center A scores: \(4,5,5,5,5,6\). Center B scores: \(0,1,5,5,9,10\). The question asks whether the population score distributions are identical.

Step 1: Verify the design. There are separate customer samples, with no customer appearing in both groups and no matching between customers. Under the stated sampling assumptions, both within-group independence and between-group independence hold. The scores are ordered, so a rank-based procedure can be considered.

Step 2: Compare the sample medians. For Center A, the two middle observations are the third and fourth values, both \(5\), so the median is \((5+5)/2=5\). For Center B, the third and fourth values are also \(5\) and \(5\), so its median is likewise \((5+5)/2=5\).

Step 3: Compare the observed spreads. Center A’s range is \(6-4=2\). Center B’s range is \(10-0=10\). Thus, the sample medians agree while the observed spreads differ substantially. These six observations per group do not establish the population shapes, but they show why equal medians cannot be substituted for identical distributions.

Step 4: State the relevant hypotheses. For the question as posed, \(H_0:F_A(t)=F_B(t)\) for every \(t\), against a difference somewhere in the distributions. If the scientific question instead concerns only a location shift, a common-shape assumption must be defensible; the equal sample medians alone do not supply that assumption.

Check: Both medians are \(5\), but the observed ranges are \(2\) and \(10\). Common mistake avoided: Concluding that equal medians imply the null of identical distributions.

Practical Conditions and Common Traps

Before selecting the rank-sum test, describe the sampling unit and how each observation was generated. This often reveals dependence that a table of values conceals. Independence within groups matters just as much as independence between them. For example, taking many measurements from one subject does not create many independent subjects. Likewise, outcomes from members of the same household, clinic, classroom, or other cluster may be dependent even when they are not literally paired.

A randomized study can support the comparison when units are assigned independently to groups and each unit contributes one independent outcome. A matched or blocked design is different: it deliberately links observations across groups, so a paired analysis or a method that accounts for the design is needed. Do not ignore the design to use a simpler two-sample test.

  • Trap: “Different groups” means independent samples. Correction: verify independent sampling within each group and independence of the two sample vectors.
  • Trap: A rank-sum test is automatically a test of medians. Correction: its basic null is equality of the full distributions. A location interpretation requires conditions such as a common-shape shift model.
  • Trap: A non-normal outcome rules out the test. Correction: normality is not required, but observations must be ordered and the independence conditions must be met.
  • Trap: The same individuals measured at two times form two independent samples. Correction: those measurements are paired; analyze the within-individual differences with an appropriate paired procedure.
Key takeaway: First establish that the outcome is ordered and that observations are independent within each group and between groups. Then state \(H_0:F_X=F_Y\). Interpret a rejection as evidence of a distributional difference; call it a location difference only when the scientific model supports that interpretation. These distinctions are aligned with the SOA VEE Mathematical Statistics syllabus.

Check Your Understanding

For each scenario, decide whether the independent-sample rank-sum framework is appropriate as stated and give the relevant null or reason it does not apply.

  1. A hypothetical insurer independently samples policyholders from two separately administered wellness programs. Each person supplies one ordered self-reported activity score. State the independence checks and the distributional null. (Answer: Appropriate if scores are independent within each program and the two samples are independent; \(H_0:F_1(t)=F_2(t)\) for every \(t\).)
  2. A lab measures the same six blood samples using two assay procedures, with one result from each assay for every sample. Is this an independent two-sample rank-sum setting? (Answer: No; the assay results are paired by blood sample, so the two sample vectors are dependent.)
  3. Two independent groups have population distributions with the same median but different spreads. Does that satisfy the rank-sum null? (Answer: Not necessarily; equal medians do not imply \(F_X(t)=F_Y(t)\) for every \(t\).)
  4. A study samples 30 workers from each of two factories, but workers within each factory share work crews and outcomes may be correlated within crew. Is it enough that no worker belongs to both samples? (Answer: No; within-group independence may fail because of crew clustering, so the ordinary independent-observation rank-sum setup is not justified as stated.)
  5. Two separately and independently sampled populations are believed to have the same distributional shape, with one possibly shifted relative to the other. What additional interpretation may be reasonable, and what remains the formal null? (Answer: A location-shift interpretation may be reasonable under the common-shape assumption; the formal null remains equality of the complete distributions, \(F_X=F_Y\).)
Clinical Biostats