All problems
Variance Reduction Factor
Problem
Antithetic variates average each pair (X, X') with correlation correlation, reducing the variance of the pair mean to (1 + correlation) / 2 times the original variance. Return that factor.
Return 0.0 when correlation is outside [-1, 1].
Hint
Negative correlation between the pair halves the variance when it reaches -1.
Test cases
case 1
in: [0]
expected: 0.5
case 2
in: [0.8]
expected: 0.9
case 3
in: [-1]
expected: 0
case 4
in: [1]
expected: 1
Starter codePython
def variance_reduction_factor(correlation):
# Your code here
pass4 test cases · run your code against them in the editor