SciPy

scipy.stats.mstats.theilslopes

scipy.stats.mstats.theilslopes(y, x=None, alpha=0.05)[source]

Computes the Theil slope as the median of all slopes between paired values.

Parameters:

y : array_like

Dependent variable.

x : {None, array_like}, optional

Independent variable. If None, use arange(len(y)) instead.

alpha : float

Confidence degree.

Returns:

medslope : float

Theil slope

medintercept : float

Intercept of the Theil line, as median(y)-medslope*median(x)

lo_slope : float

Lower bound of the confidence interval on medslope

up_slope : float

Upper bound of the confidence interval on medslope