@@ -20,10 +20,10 @@ The resulting slope and offset are the median slope and offset of the lines defi
...
@@ -20,10 +20,10 @@ The resulting slope and offset are the median slope and offset of the lines defi
### No toolbox required
### No toolbox required
This code is based on [Theil-Sen Robust Linear Regression](https://mathworks.com/matlabcentral/fileexchange/48294-theil-sen-robust-linear-regression), version 1.2.0.0, by Zachary Danziger.
This code is based on [Theil-Sen Robust Linear Regression](https://mathworks.com/matlabcentral/fileexchange/48294-theil-sen-robust-linear-regression), version 1.2.0.0, by Zachary Danziger (which in turn is based on [Theil–Sen estimator](https://de.mathworks.com/matlabcentral/fileexchange/34308-theil-sen-estimator), version 1.0.0.0 by Arnout Tilgenkamp).
A key modification is to use `median(X, 'omitnan')` instead of `nanmedian(X)` to avoid dependency on the (commercially licensed) [Statistics Toolbox](https://mathworks.com/products/statistics.html).
Note that these previous versions depend on the (commercially licensed) [Statistics Toolbox](https://mathworks.com/products/statistics.html).
(Note that there are several other implementations on Mathworks's [File Exchange](https://mathworks.com/matlabcentral/fileexchange).
Unfortunately, most were found to depend on the Statistics Toolbox, [except one](https://mathworks.com/matlabcentral/fileexchange/43135-regression-utilities), which was judged to be slower and less versatile.)
This version uses `median(X, 'omitnan')` instead of `nanmedian(X)` to avoid dependency on the Statistics Toolbox.
See the [changelog](#changelog) below for further modifications.
See the [changelog](#changelog) below for further modifications.
...
@@ -47,23 +47,24 @@ Note how a few "unlucky" outliers can bias the least squares estimate (LS), but
...
@@ -47,23 +47,24 @@ Note how a few "unlucky" outliers can bias the least squares estimate (LS), but
## Changelog
## Changelog
-October 2014 by Z. Danziger: Original version.
-December 2011 by A. Tilgenkamp: Release of version 1.0.0.0 on Mathworks File Exchange.
- September 2015 by Z. Danziger: Updated help, speed increase for 2D case
- September 2015 by Z. Danziger: Updated help, speed increase for 2D case
- March 2022 by J. Keyser: Adjusted formatting, added documentation, improved example and added plot, replaced `nanmedian(X)` with `median(X, 'omitnan')`, removed 2D special case, restructured input and output parameters.
- March 2022 by J. Keyser: Adjusted formatting, added documentation, improved example and added plot, replaced `nanmedian(X)` with `median(X, 'omitnan')`, removed 2D special case, restructured input and output parameters.
- August 2022 by J. Keyser: Explicit omission of identical x coordinates, added coefficient of determination (unadjusted R²) as optional output.
- August 2022 by J. Keyser: Explicit omission of identical x coordinates, added coefficient of determination (unadjusted R²) as optional output.
- August 2023 by J. Keyser: Add documentation about original author of version 1.0.0.0.
## Contributing and project status
## Contributing and project status
This project is relatively unmaintained.
This project is considered complete and is relatively unmaintained.
It is shared as-is in the hope to be helpful (see [license.txt](license.txt) for legal terms).
It is shared as-is in the hope to be helpful (see [license.txt](license.txt) for legal terms).
If you find a bug, feel free to let the author(s) know.
If you find a bug, please let the author(s) know.
Feature requests should be directed to the original author (see below).
## Authors
## Authors
1. Zachary Danziger, original author ([Matlab profile](https://de.mathworks.com/matlabcentral/profile/authors/1044524), [lab webpage](https://anil.fiu.edu/))