File Exchange

image thumbnail

Theil–Sen estimator

version 1.0 (1.35 KB) by

Robust regression for slope estimation between 1dimensional X and y

4.66667
4 Ratings

14 Downloads

Updated

View License

the Theil–Sen estimator, also known as Sen's slope estimator,slope selection,the single median method, or the Kendall robust line-fit method, is a method for robust linear regression that chooses the median slope among all lines through pairs of two-dimensional sample points. It is named after Henri Theil and Pranab K. Sen, who published papers on this method in 1950 and 1968 respectively. It can be computed efficiently, and is insensitive to outliers; it can be significantly more accurate than simple linear regression for skewed and heteroskedastic data, and competes well against simple least squares even for normally distributed data. It has been called "the most popular nonparametric technique for estimating a linear trend".

PS: Example code on how to use can be found in .mfile

Note: This code can only be used for the twodimensional case.

This was a response to ==>
http://www.mathworks.nl/support/solutions/en/data/1-FERW6X/index.html?product=ML&solution=1-FERW6X

Comments and Ratings (5)

Liu lb

Liu lb (view profile)

Great!

t

t (view profile)

t

t (view profile)

good

Patricia

It requires the Statistics Toolbox

Line 12:

theil=diff(y(Comb),1,2)./diff(x(Comb),1,2);

can be replaced by:

theil=deltay./deltax;

(otherwise the value assigned to deltax and deltay would be unused.

MATLAB Release
MATLAB 7.12 (R2011a)
Acknowledgements

Inspired: rfitslm, Theil-Sen Robust Linear Regression

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video