Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-293

CUPED Variance Ratio

Problem

Return the CUPED variance ratio 1 - correlation^2, the fraction of outcome variance that remains after adjusting for a pre-experiment covariate. The variance reduction only materializes when the covariate really correlates with the outcome. Return 0.0 when the absolute correlation is at least 1.

Hint

Square the correlation to get the variance removed.

Test cases

case 1
in: [0.5]
expected: 0.75
case 2
in: [-0.8]
expected: 0.3599999999999999
case 3
in: [0]
expected: 1
case 4
in: [1]
expected: 0
case 5
in: [1.5]
expected: 0
Starter codePython
def cuped_variance_ratio(correlation):
    # Your code here
    pass

5 test cases · run your code against them in the editor