FunctionRacerProblemsRace

Range for the Mean

MediumSciPyPython

Return [low, high]: the confidence interval for the mean of the population that sample was drawn from, at confidence level level (such as 0.95). Use the t distribution with n - 1 degrees of freedom, centered on the sample mean and scaled by the standard error of the mean.

Example 1

sample [2,4,4,4,5,5,7,9]
level 0.95
returns [3.2125120817637898,6.78748791823621]

The sample mean is 5 and its standard error is about 0.76. With 7 degrees of freedom the interval reaches about 1.79 to each side.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More SciPy problems