How can I implement a linear fit based on Theil–Sen estimator in MATLAB 7.13 (R2011b)?

7 ビュー (過去 30 日間)
I want to implement a linear fit based on the Theil-Sen estimator as it is insensitive to outliers.
More information can be found at:

採用された回答

MathWorks Support Team
MathWorks Support Team 2021 年 10 月 22 日
編集済み: MathWorks Support Team 2021 年 10 月 26 日
MATLAB does not have any inbuilt function to implement a linear fit based on ‘Theil–Sen’ estimator. However, if the main issue is to reduce the effect of the outliers when doing a line fit, there are several workarounds. You can achieve that in MATLAB or using various toolboxes such as Curve Fitting Toolbox, Statistics Toolbox and Optimization Toolbox.
1) Statistics Toolbox
Please refer the following documentation for ROBUSTFIT to do robust regression:
2) Curve Fitting Toolbox
There is an interactive environment, with Curve Fitting Tool accessible by typing “cftool” which allows you to exclude outliers in two different ways:
a) Algorithmically leave outliers out
You can do this via the following steps:
1) Type cftool on MATLAB command window
2) Select the “Fitting’ option, which will open the “Fit Editor”
3) Select the “New Fit” option in the “Fit Editor”
4) Select the “Fit options” in the “Fit Editor”
5) Set the “Roboust” to “On” from drop down menu
Please refer to the following link for more information about excluding outliers algorithmically:
b) Use the mouse to identify outliers using “Exclusion Rule” menu:
Please refer to the following link for more information about removing outliers using mouse:
3) MATLAB or Optimization Toolbox
Write an objective function that uses the sum of absolute-value of errors (rather than sum of squared errors). This can be done in conjunction with the solver FMINSEARCH in MATLAB, or with a solver such as FMINUNC in Optimization Toolbox.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

製品


リリース

R2011b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by