The Theil-Sen estimator, also called Sen's slope estimator or the Kendall-Theil robust line, is a method of robust estimation and nonparametric estimation for the slope
in simple linear regression. The estimator was
introduced by Theil (1950) and extended by Sen (1968). For data points , its slope estimate is the statistical
median of all pairwise slopes with distinct abscissas,
An intercept can then be estimated by
Because it uses a statistical median of slopes rather than a mean of squared residuals, the estimator is less sensitive to outliers than least squares fitting. Sen's formulation is associated with Kendall's tau: the slope can be obtained by inverting a Kendall rank-correlation test between the predictor and the fitted residuals (Sen 1968).