All problems
Spearman-Brown Prophecy
Problem
Return the Spearman-Brown prophecy value k*r / (1 + (k-1)*r) for a test lengthened k times, where r is the current reliability. Return 0.0 when r is not in (-1, 1) or k < 1.
Hint
Reliability rises with test length but with diminishing returns.
Test cases
case 1
in: [0.5,2]
expected: 0.6666666666666666
case 2
in: [0.6,2]
expected: 0.7499999999999999
case 3
in: [0.4,3]
expected: 0.6666666666666667
case 4
in: [0.5,1]
expected: 0.5
case 5
in: [-2,2]
expected: 0
Starter codePython
def spearman_brown(r, k):
# Your code here
pass5 test cases · run your code against them in the editor