Enter Paired Data
Paste one x,y pair per line. Choose delimiter rules, intercept behavior, confidence summary, decimal precision, and an optional prediction point.
Example Data Table
This sample shows a mostly linear pattern with one high outlier. The estimator remains stable because it uses median pairwise slopes.
| x | y | Comment |
|---|---|---|
| 1 | 1.1 | Near trend |
| 2 | 2.0 | Near trend |
| 3 | 3.1 | Near trend |
| 4 | 4.2 | Near trend |
| 5 | 20.0 | Strong outlier |
| 6 | 6.1 | Returns to trend |
| 7 | 7.0 | Near trend |
| 8 | 8.2 | Near trend |
Formula Used
Pairwise slopes: For every pair with different x values, compute mᵢⱼ = (yⱼ - yᵢ) / (xⱼ - xᵢ).
Theil-Sen slope: The slope estimate is the median of all valid pairwise slopes.
Intercept: With median intercept mode, calculate b₀ = median(yᵢ - b₁xᵢ). With origin mode, set b₀ = 0.
Prediction line: The fitted value is ŷ = b₀ + b₁x.
Residual diagnostics: Residuals use rᵢ = yᵢ - ŷᵢ. The page also reports median residual, median absolute residual, and residual MAD.
Slope interval: The reported interval uses empirical quantiles from the pairwise slope distribution at the selected level. This is a practical summary rather than a formal exact inference routine.
How to Use This Calculator
- Paste one numeric x,y pair on each line.
- Choose automatic or explicit delimiter handling.
- Select whether the fitted line should estimate an intercept or pass through zero.
- Pick the slope interval level and desired decimal precision.
- Optionally enter one x value for a robust prediction.
- Press Calculate estimator to show results above the form.
- Review the fitted equation, diagnostics, prediction, and row-by-row residual table.
- Use the CSV and PDF buttons to export the visible result block.
Why Use Theil-Sen Regression
Frequently Asked Questions
1. What does the Theil-Sen estimator measure?
It estimates a robust straight-line relationship between x and y by taking the median of all valid pairwise slopes, reducing outlier influence.
2. When is it better than ordinary least squares?
It is often better when your dataset contains outliers, irregular noise, or a small sample where a few extreme observations would distort a least-squares fit.
3. How many observations should I enter?
Three points are the practical minimum here, but more observations usually produce a more stable slope distribution and more meaningful diagnostic summaries.
4. What happens if some x values repeat?
Pairs with identical x values create vertical lines, so their slopes are undefined. The calculator skips those pairs and reports how many were excluded.
5. Is the slope interval a formal confidence interval?
This page reports an empirical interval from the pairwise slope distribution. It is useful for screening uncertainty, but it is not a full exact inference procedure.
6. Can I force the line through the origin?
Yes. Choose the origin option when theory requires zero intercept, such as some calibration or proportional-response situations.
7. Does the calculator handle negative or decimal values?
Yes. It accepts integers, decimals, and negative values as long as each line contains two valid numeric entries.
8. What should I review after calculating?
Check the fitted equation, residual MAD, median error summaries, Kendall tau-b, and the row table to understand fit quality and robustness.