Skip to main content

theilslopes

Function theilslopes 

Source
pub fn theilslopes(
    y: &[f64],
    x: &[f64],
    alpha: f64,
) -> Result<RobustLine, ErrorsJSL>
Expand description

The Theil-Sen line (SciPy’s theilslopes with method='separate'): the slope is the median of the pairwise slopes (yⱼ − yᵢ)/(xⱼ − xᵢ) over pairs with xⱼ > xᵢ, the intercept median(y) − slope · median(x). The confidence interval at level alpha (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 %.