About this question

Two-Sample Kolmogorov-Smirnov Statistic

Easy · statistical_analysis · Quant Researcher interview question · ks_test, goodness_of_fit, empirical_cdf, distribution_comparison, statistical_analysis

The two-sample Kolmogorov-Smirnov (KS) test is a non-parametric method for determining if two samples are drawn from the same underlying distribution. In quantitative finance, it is used to validate trading strategies by comparing live P&L distributions against backtests or monitoring for model drift. The test statistic is the maximum absolute difference between the two empirical cumulative distribution functions (ECDFs). Task Implement the function two_sample_ks_stat(x: list, y: list) that com