Expand description
Straight-line fits: least squares with its standard errors and test (SciPy’s linregress), and
the robust median-of-slopes estimators of Theil and Sen (theilslopes) and Siegel
(siegelslopes).
See the book entry More descriptive statistics and robust regression.
Structs§
- Linregress
Result - The result of
linregress. - Robust
Line - The result of
theilslopesandsiegelslopes(the latter has no confidence interval).
Functions§
- linregress
- The least-squares line
y ≈ slope · x + intercept(SciPy’slinregress), from the centred sumsSxx,Sxy,Syy:slope = Sxy/Sxx,r = Sxy/√(Sxx Syy), and the slope’s standard error√((1 − r²) Syy / ((n − 2) Sxx)). - siegelslopes
- Siegel’s repeated-medians line (SciPy’s
siegelslopeswithmethod='hierarchical'): for each point the median slope to every other point with a differentx, the slope is the median of those, and the intercept the median ofyᵢ − slope · xᵢ. Breakdown point 50 %. - theilslopes
- The Theil-Sen line (SciPy’s
theilslopeswithmethod='separate'): the slope is the median of the pairwise slopes(yⱼ − yᵢ)/(xⱼ − xᵢ)over pairs withxⱼ > xᵢ, the interceptmedian(y) − slope · median(x). The confidence interval at levelalpha(SciPy’s default 0.95) is Sen’s: order statistics of the sorted slopes at ranks(N ± z σ)/2, whereσ²is the variance of Kendall’s statistic corrected for ties. Breakdown point 29 %.