Skip to content
DeepForgeby svx
All problems
MediumML Fundamentalsml-185

Lift Confidence Interval

Problem

Compute the confidence interval for the absolute lift: (p_t - p_c) +/- z * se with the unpooled standard error se = sqrt(p_c*(1-p_c)/n_c + p_t*(1-p_t)/n_t).

Return [lower, upper]; if either sample size is 0 return [0.0, 0.0].

Hint

Use the unpooled standard error for interval estimation, unlike the pooled test statistic.

Test cases

case 1
in: [50,1000,60,1000,1.96]
expected: [-0.00997854449152891,0.0299785444915289]
case 2
in: [10,100,20,100,1.645]
expected: [0.017750000000000002,0.18225000000000002]
case 3
in: [0,100,0,100,1.96]
expected: [0,0]
case 4
in: [0,0,1,10,1.96]
expected: [0,0]
Starter codePython
import math
def lift_confidence_interval(success_c, n_c, success_t, n_t, z):
    # Returns [lower, upper]
    # Your code here
    pass

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