Nonparametric Tests

Runs Test Table: Critical Values for the Number of Runs

Critical numbers of runs for testing whether a sequence of two kinds of item is random.

  • n₁, n₂ = 2 to 20
  • Exact values
  • Paste a sequence

Runs Test Table

Two tables: lower and upper critical values for two-sided α = 0.05. Rows: n₁ · Columns: n₂.

Lower critical values: reject H₀ if R ≤ the value

Lower critical values: reject H₀ if R ≤ the value
Size of the second group (n₂) →
n₁ \ n₂ ↓
234567891011121314151617181920
2——————————222222222
3————222222223333333
4———2223333333344444
5——22333334444444555
6—223333444455555566
7—223334455555666666
8—233344555666667777
9—233445556667777888
10—233455566777788889
11—234455667778889999
12223445667778889991010
1322345566778899910101010
14233455677889991010101111
152334566778899101011111112
1623445667889910101111111212
17234456778991010111111121213
18234556788991010111112121313
192345667889101011111212131313
202345667899101011121213131314

Upper critical values: reject H₀ if R ≥ the value

Upper critical values: reject H₀ if R ≥ the value
Size of the second group (n₂) →
n₁ \ n₂ ↓
234567891011121314151617181920
2———————————————————
3———————————————————
4———99——————————————
5——910101111————————————
6——91011121213131313————————
7———1112131314141414151515—————
8———11121314141515161616161717171717
9————131414151616161717181818181818
10————131415161617171818181919192020
11————131415161717181919192020202121
12————131416161718191920202121212222
13—————1516171819192020212122222323
14—————1516171819202021222223232324
15—————1516181819202122222323242425
16——————17181920212122232324252525
17——————17181920212223232425252626
18——————17181920212223242525262627
19——————17182021222323242526262727
20——————17182021222324252526272728

Tip: click any value to highlight its row and column.

How to read this table

  1. Count n₁ and n₂, the numbers of items of each kind, and R, the number of runs (unbroken stretches of the same kind).
  2. Look up the lower critical value and the upper critical value for n₁ and n₂.
  3. Reject randomness if R is less than or equal to the lower value (clustering) or greater than or equal to the upper value (too much alternation).

Worked example

Responses in 20 consecutive patients (10 responders, 10 non-responders) form only R = 5 runs. The lower table at n₁ = n₂ = 10 gives 6 and the upper table gives 16. Because 5 ≤ 6, the responses are clustered in time, which could point to a change in patient selection or procedures during enrolment.

Click the underlined links to highlight the value in the table.

Calculator

For values between the rows and columns of the table. Results update as you type.

Formula and how the values were computed

E(R) = 1 + 2n₁n₂/(n₁ + n₂)  ·  Var(R) = 2n₁n₂(2n₁n₂ − n₁ − n₂) / ((n₁ + n₂)²(n₁ + n₂ − 1))

Values come from the exact distribution of the number of runs, P(R = r), from its closed-form combinatorial expression. The lower value is the largest r with P(R ≤ r) ≤ 0.025 and the upper value the smallest r with P(R ≥ r) ≤ 0.025.

Frequently asked questions

How do I use the runs test on numbers?

Classify each value as above or below the median (dropping values equal to it), then count runs of "above" and "below". The calculator does this when you paste numbers.

Where is it used?

Checking the randomness of a sequence, such as a randomization list, residuals from a regression model in time order, or events in a series.

Related calculators and tutorials