Set the median question first
Choose the reference median before examining the direction of the signs. For each measurement xᵢ, compare it with m: a value above m is positive, a value below m is negative, and a value equal to m is a tie. The null hypothesis says the population median is m; under a continuous distribution with that median, positive and negative signs are equally likely.
The test needs independent observations, or one independent difference per matched pair if the question is about paired change. Do not enter both members of each pair as though they were separate observations. For a paired study, first orient the difference consistently, such as after minus before, then test whether the median difference is zero or another prespecified value.
Count signs and handle ties
Let n₊ be the number of positive deviations and n₋ the number of negative deviations. The effective sample size is n = n₊ + n₋; exact ties are excluded rather than split between the two sides. Under the null, n₊ follows a Binomial(n, 0.5) distribution. Because the statistic counts signs, it ignores whether a value is one unit or one hundred units from m.
With discrete outcomes, ties can be common. Removing many ties leaves a smaller effective sample; the calculator reports the excluded count so the denominator is visible. If ties dominate, reconsider whether this test fits the scientific question.
Calculate the exact two-sided probability
For an observed positive count r, the exact two-sided p-value is twice the smaller binomial tail, capped at 1: p = min(1, 2 × min[P(B ≤ r), P(B ≥ r)]), with B distributed as Binomial(n, 0.5). The probabilities are sums of binomial terms, not a normal approximation. Discreteness means the attainable p-values jump in steps, so the realized test size may be below a nominal level.
An exact p-value is exact under the stated binomial sign model; it does not mean that the sample itself is free from bias. Selection, dependence, measurement errors, or a reference chosen after looking at the data can undermine the interpretation. The calculator implements a two-sided test and does not provide a one-sided alternative or an interval for the median.
What the sign test assumes
Independence matters because the binomial calculation treats each non-tied sign as a separate Bernoulli outcome. Repeated observations from one person, time-ordered readings with strong autocorrelation, or clustered measurements can make the effective amount of information smaller than the count suggests. The data should be collected using a design that supports the intended population claim.
The test applies to ordered data and does not require normally distributed measurements. It is usually less powerful than a method that uses magnitudes when stronger distributional assumptions are appropriate. If observations are reasonably symmetric and measured on a quantitative scale, a signed-rank method may use more information; if the mean is the target, a t-based method answers a different question.
Interpret the output in context
A small p-value indicates that the observed balance of signs would be unusual if the median were m and positive and negative deviations were equally likely. It does not tell you how far the population median is from m. Pair the test with a median estimate, a distribution summary, and the number of ties so readers can judge the direction and practical scale.
A large p-value means that this sample does not provide strong evidence against the reference median under the sign-test model. It is not proof that the true median equals m. When the sample is small, a range of practically important medians may remain compatible with the data even if the exact p-value is not small.
Worked examples
Ties are excluded from n. Each result uses the exact two-sided binomial tail calculation, not a normal approximation.
Check whether a process median differs from 10
Inputs: Observed values: 8, 9, 10, 11, 12, 13, 14; null median m = 10.
Calculation: Above 10: n₊ = 4; below 10: n₋ = 2; the value 10 is one excluded tie, so n = 6. P(B ≤ 2) = (1+6+15)/64 = 22/64; p = 2×22/64 = 0.6875.
The signs are not sufficiently imbalanced to show a median difference in this sample. The test uses six non-tied observations, not all seven.
Test a small batch against a target median
Inputs: Observed values: 12, 13, 14, 15, 16, 17, 18; null median m = 10.
Calculation: All seven observations exceed 10, so n₊ = 7 and n = 7. The two extreme tails each have probability (0.5)⁷ = 1/128; p = 2/128 = 0.015625.
This sample has a strong one-direction sign imbalance under the null model. The p-value describes compatibility with the reference median, not the size of the median shift.