Theil-Sen-Estimator

The Theil-Sen-Estimator estimates a fit of a line

\(y = m\cdot t+b\)

to a set of sample points \((t_i,y_i)\). The slope m is determined by the mean of all pairs of sample points with \(i<j\)

\((y_j-y_i)/(t_j-t_i)\)

The value of b is given by the mean of all values of

\(y_i-m\cdot t_i\)

The Theil-Sen estimator is more robust against outliers than the least square fit. The implementation is taken from Arnout Tilgenkamp (2023).