Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-086

Confidence Interval for Difference of Means (Pooled)

Problem

Return the pooled confidence interval for mean_x - mean_y using sp*sqrt(1/nx + 1/ny), with sp^2 the pooled variance. Return [0.0, 0.0] when either sample has fewer than two values.

Hint

Center the interval on the observed difference and use the supplied t critical value.

Test cases

case 1
in: [[1,2,3,4,5],[2,4,6,8,10],2]
expected: [-6.16227766016838,0.16227766016837952]
case 2
in: [[1,1,1],[1,1,1],2]
expected: [0,0]
case 3
in: [[1,2,3],[4,5,6],2.5]
expected: [-5.041241452319316,-0.9587585476806848]
case 4
in: [[5],[1,2],1.96]
expected: [0,0]
case 5
in: [[10,12],[11,13],2]
expected: [-3.8284271247461903,1.8284271247461903]
Starter codePython
def ci_difference_means(x, y, t_crit):
    # Your code here
    pass

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