Calculator
Example data table
| # | Value | x − 13 | Sign |
|---|---|---|---|
| 1 | 12 | -1 | − |
| 2 | 15 | 2 | + |
| 3 | 14 | 1 | + |
| 4 | 17 | 4 | + |
| 5 | 11 | -2 | − |
| 6 | 13 | 0 | 0 |
| 7 | 16 | 3 | + |
| 8 | 10 | -3 | − |
| 9 | 18 | 5 | + |
| 10 | 14 | 1 | + |
| # | A | B | B − A | Sign |
|---|---|---|---|---|
| 1 | 100 | 103 | 3 | + |
| 2 | 102 | 101 | -1 | − |
| 3 | 98 | 99 | 1 | + |
| 4 | 101 | 103 | 2 | + |
| 5 | 99 | 101 | 2 | + |
| 6 | 105 | 107 | 2 | + |
| 7 | 97 | 98 | 1 | + |
| 8 | 103 | 104 | 1 | + |
| 9 | 100 | 101 | 1 | + |
| 10 | 104 | 106 | 2 | + |
Formula used
The sign test is a nonparametric test for a population median (one-sample) or a median paired difference (paired). It only uses the sign of each shift relative to a hypothesized median m0.
- S = number of positive signs (values above m0).
- n = number of non-ties (values not equal to m0).
- Under H₀, S ~ Binomial(n, 0.5).
p = 2 × min{ P(S ≤ s), P(S ≥ s) }
One-sided:
p = P(S ≥ s) for “greater”, or p = P(S ≤ s) for “less”.
Z = (S − n/2) / sqrt(n/4)
with an optional continuity correction of ±0.5 for improved tail accuracy.
How to use this calculator
- Select one-sample or paired under “Test type”.
- Choose an alternative (two-sided, greater, or less) and set m0.
- Paste your values. For paired tests, enter lists A and B aligned by row.
- Pick alpha, then enable exact and/or normal methods.
- Press Submit. Review the decision, p-values, and the calculation table.
- Use Download CSV or Download PDF to export the latest result.
When the sign test is appropriate
Use the sign test when you want to test a median without assuming normality. It fits skewed, heavy‑tailed, or ordinal-like measurements where only direction matters. In paired studies, it evaluates whether the typical change differs from m0, such as a before–after shift in response time.
Data preparation and handling ties
Compute each shift: for one-sample use (x − m0); for paired use (B − A − m0) or (A − B − m0). Record the sign of each shift. Values exactly equal to m0 are ties and are removed from n. A high tie rate reduces power, so consider measurement resolution or a nearby practical m0.
Exact binomial calculation and interpretation
Let S be the number of positive signs among n non-ties. Under H0, S follows a Binomial(n, 0.5) distribution. The exact p-value sums probabilities in the relevant tail. For two-sided testing, the calculator doubles the smaller tail probability to control type‑I error conservatively for discrete outcomes.
Normal approximation and continuity correction
For larger n, S can be standardized with Z = (S − n/2) / sqrt(n/4). The normal method is fast and often accurate when n is moderate and ties are few. Continuity correction shifts S by 0.5 toward the center, improving tail accuracy when n is not very large.
Confidence bounds for the median
A distribution‑free confidence interval for the median can be built from order statistics. The method selects indices based on binomial quantiles and then reports the corresponding sorted values (or differences). With small n, the interval can be wide or even infinite on one side, which correctly reflects limited information.
Reporting results and practical guidance
Report n, S, the chosen alternative, and the primary p-value. Add the observed median and the confidence bounds to communicate magnitude, not just significance. If p is close to alpha, sensitivity checks with the exact and normal methods help. For stronger inference, increase n, reduce ties, and predefine m0 based on domain goals. For example, with n=20 and S=15, the exact two-sided p-value is 0.041, implying rejection at alpha=0.05. With n=8, p-values are coarse in steps of 1/256, so decisions may hinge on a single observation. in practice.
FAQs
1. What does the sign test measure?
It tests whether the population median (or median paired difference) equals a hypothesized value m0 using only the direction of deviations, not their size.
2. Why are ties excluded from n?
Shifts equal to m0 carry no direction, so they provide no evidence for either side. Excluding ties yields the standard binomial model with p=0.5 under H0.
3. When should I prefer the exact method?
Use the exact binomial p-value for small or moderate n, or whenever you need a fully discrete, assumption-free result. It is the default choice for careful reporting.
4. How do I choose one-sided versus two-sided?
Use two-sided when any change matters. Use one-sided only when a direction is scientifically justified before seeing data, such as expecting an increase after a process improvement.
5. What does S/n represent here?
S/n is the proportion of non-tied observations above m0. Values far from 0.5 indicate a directional shift, while values near 0.5 suggest symmetry around the hypothesized median.
6. Can I apply this to ranked or ordinal outcomes?
Yes, if you can define “above”, “below”, and “equal” relative to m0 or a paired difference. The method only needs sign information, so it works well with coarse scales.