All problems
Kolmogorov Smirnov Statistic
Problem
Given the empirical CDF values and the hypothesized CDF values at the same sorted points, the Kolmogorov-Smirnov statistic is the maximum absolute difference max_i |F_n(x_i) - F_0(x_i)|.
Given both lists, return the statistic.
Hint
Compare pointwise and take the largest gap.
Test cases
case 1
in: [[0.2,0.6,1],[0.25,0.5,0.75]]
expected: 0.25
case 2
in: [[0.5,1],[0.5,1]]
expected: 0
case 3
in: [[0.1,0.4],[0.5,0.5]]
expected: 0.4
Starter codePython
def kolmogorov_smirnov_statistic(empirical, hypothesized):
# Your code here
pass3 test cases · run your code against them in the editor