Rank Test Calculator
Compare paired observations with Wilcoxon signed ranks or independent groups with Kruskal-Wallis. Inspect every source row, excluded pair, midrank and method before exporting a complete local report.
Your observations
One pair per line, comma or tab separated, without a header. A missing cell excludes that pair explicitly. Blank lines are ignored; physical source row numbers remain visible.
At most 10,000 source rows or observations and one million input characters. Exact numeric equality defines ties; values are never rounded before ranking. Paired differences should be symmetric for a location interpretation.
Ranks and inference
Supply paired columns or independent groups, then analyze their ranks.
Wilcoxon drops zero differences, uses midranks and assumes symmetric paired differences for a location interpretation; independent-group ranks do not prove median differences without shape assumptions. Exact conditional sign enumeration via rank-sum DP for≤30nonzero pairs; explicitly labeled tie-corrected normal approximation otherwise. Kruskal uses chi-square approximation and flags any group under5. No causal/clinical advice or automatic posthoc claims.
Common questions
- When is the Wilcoxon p-value exact?
- With 1 to 30 nonzero paired differences, the calculator enumerates the conditional sign distribution using doubled midranks and a rank-sum dynamic program. Tied absolute differences are included exactly. Larger samples use an explicitly labeled tie-corrected normal approximation, with small tails evaluated directly. Probabilities below the representable floating-point range are disclosed as below 5e-324 instead of an exact zero.
- How are missing values, zeros and ties handled?
- Paired rows need two comma- or tab-separated numeric cells without a header. A missing cell excludes the pair and retains its physical source row and any supplied finite partner value. Malformed nonempty cells are rejected. Zero adjusted differences are excluded before ranking. Exact numeric ties receive midranks; values are not rounded to create ties.
- What does the expected difference change?
- The signed difference is after minus before minus your expected difference. Greater and less refer to this adjusted difference. A location interpretation assumes symmetric paired differences; the calculation does not establish a causal effect.
- What does Kruskal-Wallis test?
- The independent-group calculation pools ranks and reports tie-corrected H with a chi-square p-value. A median interpretation requires comparable distribution shapes. Groups with fewer than five observations are flagged, and no automatic posthoc comparisons are performed.
- Can I see and export every row?
- Yes. The rank table is paginated in groups of 50, while CSV and text reports include the complete result. The worksheet accepts up to 10,000 source rows or observations, 2 to 20 independent groups, and one million input characters. Input numbers use finite-precision arithmetic. CSV and full text reports retain the complete parsed numeric values, while summary statistics use readable formatting. Processing stays in a local browser worker.
- Why can a result be undefined?
- All-zero complete paired differences contain no nonzero ranks. If every independent observation is identical, the Kruskal-Wallis tie correction is zero. Both cases retain the rank data and show no invented statistic or p-value.
- How do I calculate signed ranks and read W, W+ and W−?
- Subtract before and the expected difference from after. Drop zero adjusted differences, rank the remaining absolute differences from smallest to largest, and average ranks for ties. W+ adds ranks with positive differences; W− adds ranks with negative differences. Here W is the smaller of these two sums. Load original example in paired mode to see differences 1 through 6, W+ = 21, W− = 0 and two-sided p = 0.03125. A statistic labelled V in other output may mean W+; check the stated convention.
- Can I run a one-sample Wilcoxon signed-rank test?
- Yes. Use paired mode and enter 0,observation on each line, then set Expected after − before to the hypothesized location. For observations 11, 12 and 13 tested against 10, enter 0,11 then 0,12 then 0,13 and set Expected to 10. The adjusted differences are 1, 2 and 3. Greater tests a positive location shift; Less tests a negative one, and Two-sided tests either direction under symmetric differences.
- How should I interpret the p-value and z?
- The p-value describes how unusual the signed ranks are under the selected null model and alternative. The page compares p with your alpha; it does not measure effect size or prove the null when p is larger. z appears only for the normal approximation and is based on W+ relative to its null mean, with the selected continuity correction. The continuity correction depends on the selected tail, so a near-zero sign need not indicate an observed shift. The signed-rank test does not use a degrees-of-freedom input.
- How does signed rank differ from rank sum, a sign test or a paired t-test?
- Signed rank uses paired differences and their ranked magnitudes. The Wilcoxon rank-sum test, also called Mann–Whitney U, compares independent samples and is not calculated here. Kruskal-Wallis mode also uses independent groups, but its reported H is not a Mann–Whitney U result. A sign test counts positive and negative differences without ranking magnitudes; a paired t-test tests the mean difference. These are distinct tests with different assumptions.
- What should I include when reporting a signed-rank result?
- State the paired or one-sample setup, expected difference, alternative, nonzero sample size, handling of ties and zeros, statistic convention, p-value and exact or approximate method. Copy report or Download report supplies those computed details and the source ranks. Explain the study context separately. The output is a plain report, not an APA-formatted table, critical-value table or published paper.
- Can numeric ordinal or Likert scores be analyzed?
- The parser accepts numeric scores, but calculating their differences does not establish that the numerical spacing is meaningful. A location interpretation needs symmetric differences on a scale where those differences can be interpreted. The page shows the supplied ranks and exclusions; it does not select a study design or certify these assumptions.
- Can I paste spreadsheet data or use a phone?
- Copy two numeric columns from Excel or Google Sheets and paste them into paired mode without a header. Tabs separate the cells and newlines separate pairs. CSV export returns the source ranks for use in a spreadsheet; this page does not run inside Excel or supply a spreadsheet add-in. It runs in a current phone or computer browser with local worker support, with nothing to install.
- How do I run and interpret the paired signed-rank example in R?
- In R, enter before <- c(1,2,3,4,5,6); after <- c(2,4,6,8,10,12); then run stats::wilcox.test(after, before, paired=TRUE, mu=0, alternative="two.sided", exact=TRUE, correct=FALSE). Put after first so the differences match this page's after minus before. For these six nonzero, untied differences, R reports V = 21 and two-sided p = 0.03125. V is the positive rank sum, which is W+ here; this page's W is min(W+, W−), so W = 0 is not a disagreement. The p-value concerns the symmetric-difference null model, not effect size or causality. For a nonzero expected difference, change mu and the page's Expected field together. R's exact handling of ties and zeros can differ by version and settings; do not assume this untied example establishes agreement for other data.
- What is the Mann–Whitney U test formula?
- Pool the two independent samples, rank all observations from smallest to largest, and use average ranks for ties. With sample sizes n1 and n2 and first-sample rank sum R1, U1 = R1 − n1(n1 + 1)/2 and U2 = n1*n2 − U1. In this convention U1 counts second-sample values below first-sample values, with half credit for ties. For samples [1,3] and [2,4], R1 = 1 + 3 = 4, so U1 = 1 and U2 = 3. Some reports label the opposite count U1 or report the smaller U; state the convention. This formula alone gives no p-value or critical value. The calculator above reports Kruskal-Wallis H for independent groups and does not calculate a Mann–Whitney U test.
Wilcoxon drops zero differences, uses midranks and assumes symmetric paired differences for a location interpretation; independent-group ranks do not prove median differences without shape assumptions. Exact conditional sign enumeration via rank-sum DP for≤30nonzero pairs; explicitly labeled tie-corrected normal approximation otherwise. Kruskal uses chi-square approximation and flags any group under5. No causal/clinical advice or automatic posthoc claims.