Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Theil-Sen-Matlab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Keyser, Johannes
Theil-Sen-Matlab
Commits
7ca7d65a
Commit
7ca7d65a
authored
3 years ago
by
Keyser, Johannes
Browse files
Options
Downloads
Patches
Plain Diff
Small fixes in documentation.
parent
7000c91f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+3
-3
3 additions, 3 deletions
README.md
TheilSen.m
+2
-2
2 additions, 2 deletions
TheilSen.m
example.m
+1
-1
1 addition, 1 deletion
example.m
with
6 additions
and
6 deletions
README.md
+
3
−
3
View file @
7ca7d65a
...
...
@@ -8,12 +8,12 @@ A stand-alone Theil-Sen estimator for robust regression in Matlab.
### Theil-Sen estimator
A
[
Theil-Sen estimator
](
https://en.wikipedia.org/wiki/Theil%E2%80%93Sen_estimator
)
provides robust linear regression in the 2D plane:
A
[
Theil-Sen estimator
](
https://en.wikipedia.org/wiki/Theil%E2%80%93Sen_estimator
)
provides robust
, simple
linear regression in the 2D plane:
The resulting estimates of slope and intercept are relatively insensitive to outliers.
The
present
implementation of
[
TheilSen.m
](
TheilSen.m
)
is exact but "naive":
The implementation of
[
TheilSen.m
](
TheilSen.m
)
is exact but "naive":
It generates the set of all pairs of the _n_ input samples, resulting in an overall complexity of _O(n²)_ in both speed and space.
The resulting slope and offset are the median slope and offset of
all
lines defined by
the
data point pairs.
The resulting slope and offset are the median slope and offset of
the
lines defined by
all
data point pairs.
(Note that other implementations of the algorithm achieve better complexity, and are thus much faster for large amounts of data points.)
...
...
This diff is collapsed.
Click to expand it.
TheilSen.m
+
2
−
2
View file @
7ca7d65a
function
[
b1
,
b0
]
=
TheilSen
(
X
,
y
)
% THEILSEN performs Theil-Sen robust, simple linear regression(s) of X on y.
%
% Note that
multipl
e predictor variables in X are treated as independent
% simple regressions; do
n'
t confuse the output with multiple regression.
% Note that
two or mor
e predictor variables in X are treated as independent
% simple regressions; do
no
t confuse the output with multiple regression.
%
% THEILSEN treats NaNs in X or y as missing values, and ignores them.
%
...
...
This diff is collapsed.
Click to expand it.
example.m
+
1
−
1
View file @
7ca7d65a
...
...
@@ -30,7 +30,7 @@ data_y(outlr_idx) = outlr_y;
est_ls
=
[
ones
(
N_total
,
1
),
data_x
]
\
data_y
;
% Estimate Theil-Sen parameters.
[
m
,
b
]
=
TheilSen
(
[
data_x
,
data_y
]
);
[
m
,
b
]
=
TheilSen
(
data_x
,
data_y
);
est_ts
=
[
b
,
m
];
% Plot everything and add comparison of estimates to title.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment