Range for the Mean
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
3 <= len(sample) <= 40levelis 0.9, 0.95 or 0.99- The values are not all equal
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More SciPy problems
- Two Groups ComparedMedium
- Where It Crosses ZeroMedium
- Chains of Close PointsHard
- Fish in the LakeHard
- Fit the Growth CurveHard
- Implied VolatilityHard
- Most Profit PlanHard
- Safest MixHard