Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-052

Confidence Interval for Mean (Known Sigma)

Problem

Return the confidence interval [mean - z*sigma/sqrt(n), mean + z*sigma/sqrt(n)] for the mean with known sigma. Return [0.0, 0.0] for empty data.

Hint

Center the interval on the sample mean and add/subtract the margin of error.

Test cases

case 1
in: [[1,2,3,4,5],2,1.96]
expected: [1.246922705640165,4.753077294359835]
case 2
in: [[10],1,1]
expected: [9,11]
case 3
in: [[],1,1]
expected: [0,0]
case 4
in: [[2,4],0,1.96]
expected: [3,3]
case 5
in: [[0,0,0,0],5,2]
expected: [-5,5]
Starter codePython
def ci_mean_known_sigma(data, sigma, z_crit):
    # Your code here
    pass

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