About this question
Medium · statistical_analysis · Quant Researcher interview question · theil_sen, robust_regression, slope_estimation, outlier_resistance, statistical_analysis
The Theil-Sen estimator provides a robust alternative to Ordinary Least Squares (OLS) for trend estimation, which is crucial for financial data prone to outliers and regime shifts. By calculating the median of all pairwise slopes between data points, it resists the influence of extreme values. This method is widely used in quantitative finance for applications like robust signal decay analysis and macro factor trend fitting. Task Implement the function theil_sen_slope(x: list, y: list) -> float