Calculator Inputs
Example Data Table
| Observation | X | Y | Comment |
|---|---|---|---|
| 1 | 1.0 | 2.1 | Early baseline point |
| 2 | 2.0 | 2.9 | Near fitted trend |
| 3 | 3.0 | 4.2 | Moderate upward movement |
| 4 | 4.0 | 5.0 | Steady continuation |
| 5 | 5.0 | 6.1 | Stable observation |
| 6 | 6.0 | 7.4 | Above line slightly |
| 7 | 7.0 | 7.8 | Below line slightly |
| 8 | 8.0 | 9.2 | Regular increase |
| 9 | 9.0 | 10.1 | Near trend fit |
| 10 | 10.0 | 13.8 | Mild high-side outlier |
Formula Used
Main fitted line: ŷ = a + b x
Theil-Sen slope: compute every valid pairwise slope, then take the median.
b = median((yj - yi) / (xj - xi)), for all pairs where xj ≠ xi.
Intercept: calculate a = median(yi - b xi).
Predicted value: ŷi = a + b xi.
Residual: ei = yi - ŷi.
MAE: average absolute residual size.
RMSE: square root of the mean squared residual.
Pseudo R²: 1 - SSE / SST, where SSE = Σe² and SST = Σ(y - ȳ)².
Spearman rank correlation: Pearson correlation applied to average ranks.
Kendall tau-b: compares concordant and discordant pairs while adjusting for ties.
Repeated median option: take the median slope around each point first, then the median of those pointwise medians.
How to Use This Calculator
- Enter one x,y pair on each line in the dataset box.
- Select either Theil-Sen Median Slope or Siegel Repeated Median.
- Choose the slope percentile band and number of decimal places.
- Optionally enter a future or target x-value for prediction.
- Pick how you want the detailed result table sorted.
- Press Run Rank Based Regression.
- Review the result summary above the form, inspect the Plotly graph, and compare actual versus fitted values.
- Use the CSV or PDF buttons to export the summary and fitted table.
Frequently Asked Questions
1) What does rank based regression mean here?
Here it means a robust line-fitting approach tied to rank-style association. The calculator fits a median-based trend line and also reports Spearman and Kendall rank measures for added interpretation.
2) Why use this instead of ordinary least squares?
Ordinary least squares can be strongly pulled by unusual observations. Median-slope methods are often steadier when data contain outliers, skewness, or small departures from a clean linear pattern.
3) What is the difference between Theil-Sen and repeated median?
Theil-Sen uses the median of all valid pairwise slopes. Repeated median first computes a median slope around every point, then takes the median of those values. The second option is usually more resistant to difficult points.
4) Can I include duplicate x-values?
Yes, but at least two distinct x-values are required overall. Pairs with identical x-values do not produce usable slopes, so they are skipped during estimation.
5) What does the slope percentile band show?
It shows lower and upper percentiles from the slope distribution used by the robust fit. It is a practical spread indicator for slope stability, not a formal inferential guarantee.
6) How are outliers flagged?
Potential outliers are flagged from residual size using a robust residual scale derived from the median absolute deviation. It is a screening signal, not an automatic decision rule.
7) What minimum data size should I use?
Three or more pairs are recommended. Two points define a line, but they do not provide enough structure for meaningful diagnostics, rank comparisons, or residual interpretation.
8) Can I use the calculator for forecasting?
Yes, for cautious short-range prediction. Enter a target x-value and the calculator will estimate y from the fitted robust line. Forecast reliability still depends on data quality and pattern stability.