I found by accident the nonparametric Theil-Sen Estimator as a replacement for standard OLS linear Regression. How well does it perform with autocorrelated data, non-normal residuals and heteroskedasticity?
Solved – Theil-Sen estimator assumptions
autocorrelationheteroscedasticitynonparametricnormality-assumptionregression
Related Solutions
No, you can't use an intercept of zero. It's not clear what that would mean for this test. As the wikipedia page describes, this test computes the slope for all pairs of points and then reports the median of those slopes. If you know you want the fitted line to start at zero, this doesn't quite make sense. Maybe you'd want to compute the slopes of all points compared with that zero point only, but that wouldn't be the Theil-Sen estimate anymore; it would just be the sign test.
And no, you can't use a matrix on the right side; this test is for one predictor only. The slope between two pairs of points then has both a magnitude and a direction, and it's not clear how one would take the median of them.
Finally, the default for this function is to use Siegel repeated medians; for the Thiel-Sen test, you need to specify repeated=FALSE
. See the help page for more information.
The Theil-Sen estimator is essentially an estimator for the slope alone; the line has been constructed in a host of different ways - there are a large variety of ways to calculate the intercept.
You said:
My understanding of the intercept calculation is that I first calculate the median slope, and then construct a line through every data point with this slope, find the intercept of every line, and then take the median intercept.
A common one (probably the most common) is to compute median($y-bx$). This is what Sen looked at, for example; if I understand your intercept definition correctly this is the same as the intercept you mention.
There are a couple of approaches that compute the intercept of the line through each pair of points and attempts to get some kind of weighted-median but based off that (putting more weight on the points further apart in x-space).
Another is to try to get an estimator with higher efficiency at the normal (akin to that of the slope estimator in typical situations) and similar breakdown point to the slope estimate (there's probably little point in having better breakdown at the expense of efficiency), such as using the Hodges-Lehmann estimator (median of pairwise averages) on $y-bx$. This has a kind of symmetry in the way the slopes and intercepts are defined ... and generally gives something very close to the LS line when the normal assumptions nearly hold, whereas the Sen-intercept can be - relatively speaking - quite different.
Some people just compute the mean residual.
There are still other suggestions that have been looked at. There's really no 'one' intercept to go with the slope estimate.
Dietz lists several possibilities, possibly even including all the ones I mentioned, but that's by no means exhaustive.
Best Answer
It should cope with non-normal errors without difficulty and is robust to both y and x-outliers (influential observations), and so isn't badly affected by influential outliers (unlike L1 regression; see the example here).
However, it can't handle more than about 29% gross outliers (in the worst case) or a bit less in small samples.
Estimation wise it should behave reasonably in the presence of heteroskedasticity or autocorrelation, but the performance of hypothesis tests ad intervals would be affected by autocorrelation and I think by at least some kinds of heteroskedasticity (but I haven't investigated this).