bundles / scipy latest / scipy / stats / _mstats_basic / theilslopes
function
scipy.stats._mstats_basic:theilslopes
Signature
def theilslopes ( y , x = None , alpha = 0.95 , method = separate ) Summary
Computes the Theil-Sen estimator for a set of points (x, y).
Extended Summary
theilslopes implements a method for robust linear regression. It computes the slope as the median of all slopes between paired values.
Parameters
y: array_likeDependent variable.
x: array_like or None, optionalIndependent variable. If None, use
arange(len(y))instead.alpha: float, optionalConfidence degree between 0 and 1. Default is 95% confidence. Note that
alphais symmetric around 0.5, i.e. both 0.1 and 0.9 are interpreted as "find the 90% confidence interval".method: {'joint', 'separate'}, optionalMethod to be used for computing estimate for intercept. Following methods are supported,
'joint': Uses np.median(y - slope * x) as intercept.
'separate': Uses np.median(y) - slope * np.median(x)
as intercept.
The default is 'separate'.
Returns
result: ``TheilslopesResult`` instanceThe return value is an object with the following attributes:
slope
slope
intercept
intercept
low_slope
low_slope
high_slope
high_slope
Notes
For more details on theilslopes, see scipy.stats.theilslopes.
See also
- siegelslopes
a similar technique using repeated medians
Aliases
-
scipy.stats._mstats_basic.theilslopes