All problems
Control Variate Variance Reduction
Problem
With the optimal control-variate coefficient, the variance of an estimator is reduced by a factor of 1 - correlation^2 relative to the crude estimator. Return that factor, or 0.0 when the correlation is outside [-1, 1].
Hint
The residual variance after the best linear control is the fraction 1 - rho^2.
Test cases
case 1
in: [0.5]
expected: 0.75
case 2
in: [0.9]
expected: 0.18999999999999995
case 3
in: [0]
expected: 1
case 4
in: [-0.8]
expected: 0.3599999999999999
case 5
in: [1.2]
expected: 0
Starter codePython
def control_variate_variance_reduction(correlation):
# Your code here
pass5 test cases · run your code against them in the editor