Pairwise Averages / Differences / Slopes
This tool lists every pairwise combination of the data and summarises it robustly. Pairwise averages give the Hodges-Lehmann estimate of a sample's centre, pairwise differences the Hodges-Lehmann shift between two independent samples, and pairwise slopes the Theil-Sen slope. Use it for skewed data or outliers. Observations must be independent. Output includes the estimate, confidence intervals for averages and differences, a table and a histogram.
Last reviewed
Key takeaway
Pairwise Averages, Differences and Slopes give robust, distribution-free estimates: the Hodges-Lehmann median of one sample, the Hodges-Lehmann shift between two samples, and the Theil-Sen slope of a trend.
On this page
Purpose
Pairwise Averages / Differences / Slopes lists every pairwise combination of your data and summarises it with a robust, distribution-free estimate. Pairwise averages give the Hodges-Lehmann estimate of a sample's centre; pairwise differences give the Hodges-Lehmann estimate of the shift between two independent samples; pairwise slopes give the Theil-Sen (Sen's slope) estimate of a trend. Use them when the data are skewed or contain outliers and you do not want a few extreme values to pull a mean or a least-squares slope.
Key Capabilities
- Three tools in one, chosen with Type: pairwise averages (one sample), pairwise differences (two independent samples) and pairwise slopes (paired X and Y).
- Hodges-Lehmann estimate of the median with a confidence interval from the Wilcoxon signed-rank test.
- Hodges-Lehmann estimate of the shift between two samples with an approximate confidence interval from the Mann-Whitney distribution.
- Theil-Sen slope: the median of all pairwise slopes.
- Table of the pairwise values (first 200 shown) and a histogram of all of them.
- Data Options: subset the rows before the analysis.
Statistical Methods
Pairwise averages: for n observations the tool forms all n(n + 1)/2 Walsh averages (xᵢ + xⱼ)/2 with i ≤ j, including each value with itself. Their median is the Hodges-Lehmann estimate of the population median (the centre of a symmetric distribution). The confidence interval contains every Walsh average that the two-sided Wilcoxon signed-rank test, used as a test of the median, does not reject at α = 1 − confidence level (exact test up to 50 observations, normal approximation above).
Pairwise differences: for samples of sizes n₁ and n₂ the tool forms all n₁·n₂ differences xᵢ − yⱼ; their median is the Hodges-Lehmann estimate of the shift between the two populations. The approximate confidence interval runs from the (k+1)-th smallest to the (k+1)-th largest difference, with k = floor(n₁n₂/2 − z·√(n₁n₂(n₁ + n₂ + 1)/12)), the normal approximation to the Mann-Whitney statistic. Missing values are dropped from each sample separately.
Pairwise slopes: for n paired (x, y) observations the tool forms the slope (yⱼ − yᵢ)/(xⱼ − xᵢ) for every pair with different x values; pairs with tied x are skipped. The median of these slopes is the Theil-Sen estimate, which is not affected by up to about 29% of wild points. No confidence interval is given for the slope. All three estimates assume independent observations; pairwise averages also assume a roughly symmetric distribution.
Input Fields & Options
Field | Description |
Type | Pairwise Averages (one sample: Walsh averages / Hodges-Lehmann estimator, default), Pairwise Differences (two independent samples: Hodges-Lehmann shift estimator) or Pairwise Slopes (paired X/Y: Theil-Sen / Sen's slope estimator). |
Variable | Numeric column. Required for Pairwise Averages. |
First sample / Second sample | Numeric columns. Required for Pairwise Differences; the differences are first − second. |
X variable / Y variable | Numeric columns of paired values. Required for Pairwise Slopes. |
Confidence level | Default 95, from 75 to 100. Used for Pairwise Averages and Pairwise Differences only. |
Data Options: Subset (optional) | Exclude matching rows (default) or Include only matching rows, by row numbers and/or a condition. |

Figure 1 — Options for the bulb life example: Pairwise Averages of Hours at 95% confidence.
Output Descriptions
- Summary table — the column(s) used, N (or N1 and N2), the number of pairwise values, the estimate (Hodges-Lehmann median, Hodges-Lehmann shift or Theil-Sen slope) and, for averages and differences, the confidence interval.
- Table of pairwise values — sorted, first 200 rows.
- Histogram of all the pairwise values.
- PDF export via Download.

Figure 2 — Pairwise averages of the burn times: 5050 Walsh averages, Hodges-Lehmann estimate 1248.28 hours, 95% CI 1232.335 to 1263.55 hours.
Worked Example
A quality engineer tests 100 light bulbs to failure (Hours, 1044 to 1510 hours) and wants a typical burn time with a confidence interval, without assuming a normal distribution. The engineer chooses Pairwise Averages, selects Hours as the variable and keeps 95% confidence.
The tool forms 100 × 101 / 2 = 5050 pairwise averages. Their median, the Hodges-Lehmann estimate of the typical burn time, is 1248.28 hours, with a 95% confidence interval of 1232.335 to 1263.55 hours. The histogram of the pairwise averages is single-peaked and nearly symmetric around that value.
For comparison, the ordinary mean of the data is 1248.00 hours and the t-based 95% interval is about 1231.3 to 1264.7 hours: with these fairly symmetric data the robust and the classical answers agree, which gives the engineer confidence in the figure. With skewed data or a few very early failures, the Hodges-Lehmann estimate would move much less than the mean. To compare two bulb designs, the engineer would choose Pairwise Differences and read the Hodges-Lehmann shift and its interval.
Frequently asked questions
What is the Hodges-Lehmann estimator?
For one sample, the Hodges-Lehmann estimator is the median of all Walsh averages, the pairwise averages (xi + xj)/2 including each value with itself, and estimates the centre of a symmetric distribution. For two independent samples, it is the median of all pairwise differences and estimates the shift between the two populations.
What is the Theil-Sen slope?
The Theil-Sen slope, also called Sen's slope, is the median of the slopes between every pair of (x, y) points with different x values; pairs with tied x are skipped. It is not affected by up to about 29% of wild points. No confidence interval is given for the slope.
When should you use pairwise averages, differences or slopes?
Use them when the data are skewed or contain outliers and you do not want a few extreme values to pull a mean or a least-squares slope. Choose pairwise averages for one sample, pairwise differences for two independent samples, and pairwise slopes for paired X and Y data showing a trend.
What are the assumptions of the Hodges-Lehmann estimate?
All three estimates assume independent observations, and pairwise averages also assume a roughly symmetric distribution. The confidence interval for pairwise averages comes from the Wilcoxon signed-rank test, and the interval for pairwise differences is an approximation based on the Mann-Whitney distribution.
