Statistical Methods
Fit a Trend with Repeated Median Slopes
Define the research task
Use repeated-median fitting as a prespecified sensitivity analysis for a roughly linear relationship where a few unusual observations could dominate least squares. Inspect the scatterplot first and preserve unusual observations for investigation. A robust line does not repair confounding, nonlinearity, dependence or measurement error in the predictor.
Work through the check
- Keep actual x coordinates, particularly when observations are irregularly spaced.
- For each point, calculate slopes to every other point.
- Take a median within each point, then a median across those medians.
- Use median(y − slope × x) for the hierarchical intercept.
- Compare fitted values and residual patterns with the scientific model.
This is not the median of all pooled pairwise slopes. The browser tool requires distinct x values and does not estimate uncertainty. Record the intercept convention so another analyst can reproduce the fit.
Hypothetical example and reporting
For hypothetical x = 0,1,2,3,4 and y = 1,3,5,7,100, the repeated-median slope is 2 and hierarchical intercept is 1. The line fits the first four observations; the last residual is 91. That discrepancy still needs investigation. Report the unusual point and the sensitivity analysis, rather than presenting the robust fit as evidence that the point is erroneous.
Source and verification
Method checked 26 November 2026 against SciPy primary documentation: stats.siegelslopes. Examples are synthetic; this page does not assert human expert approval.