Tutorials › Introduction to Statistics › The One-Sample Sign Test

Nonparametric Alternatives · Tutorial 950 of 996

The One-Sample Sign Test

Use the one-sample sign test to assess a hypothesized population median by counting signs and evaluating their binomial probabilities.

Intermediate 10 min read

What You'll Learn

  • State the assumptions that support a one-sample sign test.
  • Translate a median hypothesis into a hypothesis about sign probabilities.
  • Exclude observations equal to the hypothesized median and identify the effective sample size.
  • Calculate exact one-sided and two-sided binomial p-values.
  • Interpret a test decision in the context of the measured variable.

Why Test a Median With Signs?

A sample can contain extreme values or come from a distribution whose shape is not well described by a normal model. In that setting, a test about the population median can use a simpler feature of the data: whether each observation falls above or below a proposed median. The one-sample sign test uses only those directions. It does not use the distances from the proposed median, so an observation one unit above and one a hundred units above contribute the same sign.

This simplicity comes with a tradeoff: because it discards distance information, the sign test may be less sensitive than a method that uses more of the data when that method's assumptions are appropriate. Its appeal is that its null distribution can be obtained directly from a binomial model, without assuming that the measurements themselves are normally distributed.

Definition: The one-sample sign test tests a hypothesized population median \(m_0\) by counting how many sampled observations are above and below \(m_0\). An observation equal to \(m_0\) is a tie and contributes neither an above nor a below sign. Let \(n^*\) be the number of observations not tied at \(m_0\), and let \(S\) be the number of those \(n^*\) observations above \(m_0\).

Hypotheses and the Binomial Null Model

For a continuous population with a unique median \(M\), the median hypotheses can be expressed using the chance that a measurement exceeds \(m_0\). Under \(H_0:M=m_0\), half the population is above \(m_0\) and half is below it. Thus, for each observation, the probability of an above sign is \(0.5\). If the observations are independent, the number of above signs follows a binomial distribution under the null.

Model and assumptions: The observations are independent and come from the population of interest. Under \(H_0:M=m_0\), each non-tied observation has probability \(0.5\) of being above \(m_0\) and probability \(0.5\) of being below it. Then $$ S\sim \operatorname{Binomial}(n^*,0.5). $$ A continuous population at \(m_0\) supports the equal-sign-probability condition. For data with substantial ties, such as rounded or discrete measurements, having \(m_0\) be a median alone does not necessarily make the non-tied signs equally likely; that condition must be justified separately.

The sign probabilities give the direction of the test. For a continuous population with a unique median, \(H_a:M>m_0\) corresponds to more than half the population being above \(m_0\), so large values of \(S\) support this alternative. \(H_a:M<m_0\) corresponds to fewer than half being above \(m_0\), so small values support it. For \(H_a:M\ne m_0\), unusually small or unusually large counts support a difference.

If some observations equal \(m_0\), omit them from the count and use \(n^*\), not the original sample size, in the binomial model. A tie supplies no direction relative to the proposed median. If every observation is tied, then \(n^*=0\), so there are no signs from which to conduct this test.

Why the Null Distribution Is Binomial

For each non-tied observation, define an indicator that equals 1 if the observation is above \(m_0\), and 0 if it is below. Under \(H_0\), each indicator has probability \(0.5\) of equaling 1. Independence of the observations makes these indicators independent. The statistic \(S\) is their sum, which is exactly the binomial setup.

$$ S=\sum_{i=1}^{n^*} I_i,\qquad P(I_i=1)=0.5,\qquad P(S=k)=\binom{n^*}{k}(0.5)^{n^*}. $$

The probability formula follows by counting the possible sign patterns. A particular pattern with \(k\) above signs and \(n^*-k\) below signs has probability \((0.5)^k(0.5)^{n^*-k}=(0.5)^{n^*}\). There are \(\binom{n^*}{k}\) ways to choose which \(k\) observations are above. Multiplying the number of patterns by the probability of each gives the displayed probability. This is the justification for the exact binomial calculations in the examples.

Calculating and Interpreting P-Values

A p-value is calculated under \(H_0\), using the binomial model, and measures how often a result at least as extreme as the observed count would occur in the direction specified by \(H_a\). For an upper-tailed test, include the observed count and all larger counts. For a lower-tailed test, include it and all smaller counts. These are inclusive tails: the observed outcome itself is part of the p-value.

Worked Example: A One-Sided Test for a Larger Median

Suppose a hypothetical sample contains 10 independent, non-tied measurements of a continuous outcome. Nine are above 42 units and one is below. Test \(H_0:M=42\) against \(H_a:M>42\) at \(\alpha=0.05\). Assume the sampling process represents the population of interest and the continuous-measurement model is reasonable.

Here \(n^*=10\) and \(S=9\). Under \(H_0\), \(S\sim\operatorname{Binomial}(10,0.5)\). Since larger counts support \(H_a\), the exact p-value is

$$ P(S\ge 9) =\binom{10}{9}(0.5)^{10}+\binom{10}{10}(0.5)^{10} =\frac{10+1}{1024} =0.01074. $$

Because \(0.01074<0.05\), reject \(H_0\) at the 5% significance level. In this hypothetical sample, the signs provide evidence that the population median exceeds 42 units. The conclusion concerns the population median; it does not say that every observation, or the sample mean, exceeds 42.

For a two-sided test, extreme counts on either end are evidence against the null. Because the binomial null distribution with probability \(0.5\) is symmetric, a commonly used exact two-sided p-value is twice the smaller inclusive tail probability, capped at 1:

$$ p\text{-value} =\min\left(1,\;2\min\{P(S\le s),P(S\ge s)\}\right), $$

where \(s\) is the observed count. This is the equal-tail convention used below. Its discreteness means that attainable p-values occur in steps rather than taking every possible value between 0 and 1.

Worked Example: A Two-Sided Test for a Median Difference

In a hypothetical study, nine independent observations from a continuous measurement are compared with 18 units. Eight observations are above 18 and one is below. Test \(H_0:M=18\) against \(H_a:M\ne18\) at \(\alpha=0.05\). Assume the sample represents the target population and the independence and continuous-measurement conditions are reasonable.

There are no ties, so \(n^*=9\) and \(S=8\). The smaller tail is the upper tail:

$$ P(S\ge 8) =\binom{9}{8}(0.5)^9+\binom{9}{9}(0.5)^9 =\frac{9+1}{512} =0.01953. $$

By symmetry, the lower tail \(P(S\le1)\) is also 0.01953. Therefore the two-sided p-value is

$$ p\text{-value}=2(0.01953)=0.03906. $$

Since \(0.03906<0.05\), reject \(H_0\) at the 5% level. The signs provide evidence that the population median differs from 18 units. The observed imbalance points toward a median above 18, but the stated alternative was two-sided; the test's conclusion is evidence of a difference, not proof that the median is greater.

Worked Example: A One-Sided Test for a Smaller Median

A hypothetical set of eight independent, non-tied observations from a continuous outcome includes one value above 6 hours and seven below. Test \(H_0:M=6\) hours against \(H_a:M<6\) hours at \(\alpha=0.05\). Assume the sample is suitable for the target population and the model conditions are reasonable.

Here \(n^*=8\) and \(S=1\). Small counts support the alternative, so the exact lower-tail p-value is

$$ P(S\le 1) =\binom{8}{0}(0.5)^8+\binom{8}{1}(0.5)^8 =\frac{1+8}{256} =0.03516. $$

Because \(0.03516<0.05\), reject \(H_0\) at the 5% significance level. The data provide evidence that the population median is below 6 hours. The p-value is the probability, assuming \(H_0\) and the model, of observing one or fewer above signs; it is not the probability that \(H_0\) is true.

Assumptions, Ties, and Practical Meaning

The sign test does not assume a normal distribution, but it is not assumption-free. Independence matters because the binomial model treats the signs as independent trials. The sample should also represent the population to which the conclusion refers; a small p-value does not repair a biased sampling process. Finally, the null sign probability must be \(0.5\). For continuous data with \(m_0\) as the median, this follows from the median condition. With discrete or rounded data, it may not.

For example, suppose many observations equal a proposed value because a measurement is rounded to the nearest whole unit. Omitting those tied observations is the usual sign-test calculation, but it does not by itself guarantee that the remaining signs have equal probabilities under the null. If the distribution has an atom at \(m_0\), the conditional proportion above \(m_0\) among non-ties need not be \(0.5\). In such a case, the binomial p-value is justified only if the equal-probability condition is otherwise supported.

The sign test also deliberately ignores magnitude. If two samples have the same number of above signs, they have the same sign-test statistic even if one sample's observations are barely above \(m_0\) and the other's are far above it. This makes the test resistant to the influence of extreme distances, but it can lose information when distance from the hypothesized median is meaningful.

Key takeaway: Choose the alternative before looking at the result, count only non-tied signs, and calculate the p-value from \(S\sim\operatorname{Binomial}(n^*,0.5)\) under the stated assumptions. A small p-value is evidence against the hypothesized median in the direction specified by \(H_a\); it is not a probability that the null hypothesis is true.

Common Mistakes

  • Using the original sample size after removing ties. The binomial model uses \(n^*\), the number of non-tied observations, because only those observations contribute signs.
  • Choosing a tail after seeing the data. The alternative determines which outcomes count as extreme. A one-sided upper-tail calculation is not justified merely because the observed count is large; the direction must be specified in \(H_a\).
  • Doubling a tail for a one-sided test. A one-sided alternative uses its designated tail only. The equal-tail two-sided calculation doubles the smaller tail because it allows departures in either direction.
  • Assuming ties never matter. Tied observations are omitted from the count, but substantial ties can make the equal-sign-probability assumption questionable, especially for discrete or rounded measurements.
  • Interpreting a p-value as the chance the null is true. It is calculated assuming the null model and describes the probability of results at least as extreme as the observed result.

Check Your Understanding

Use the sign-test model and assumptions to answer the following questions.

  1. For a test of \(H_0:M=20\) against \(H_a:M>20\), which observed sign counts contribute to the p-value if \(n^*=7\) and \(S=5\)?
  2. A sample has 12 observations, including 2 exactly equal to \(m_0\). What is \(n^*\), and which count is used as the binomial statistic?
  3. Why does a continuous population with median \(m_0\) support an equal probability of above and below signs under the null?
  4. In a two-sided test with \(n^*=8\) and \(S=1\), which two tails are included by the equal-tail p-value convention?
  5. Why might omitting tied values fail to justify a binomial model for rounded or discrete data?