All problems
Control Variate Variance Ratio
Problem
With a control variate correlated at level rho with the target estimator, the optimal variance reduction leaves the ratio 1 - rho^2 of the original variance.
Given the correlation coefficient rho, return the variance ratio.
Hint
Perfect correlation annihilates the variance.
Test cases
case 1
in: [0.5]
expected: 0.75
case 2
in: [0.99]
expected: 0.01990000000000003
case 3
in: [0]
expected: 1
Starter codePython
def control_variate_variance_ratio(rho):
# Your code here
pass3 test cases · run your code against them in the editor