Confidence Interval for the Mean(Sigma Not Known) with Python
Part 35 of the series "Probability Theory and Statistics with Python"
In the previous article, we look at how confidence interval for the mean can be found when we know the value of sigma. But more often we don’t have this value.
Differences
Let’s look at differences in inequalities for confidence intervals when we know sigma and when we don’t.
The differences are:

we use sample sigma rather than population sigma

we use tvalue rather than zvalue
We already knew how to find sample variance. But how to find tvalue?
Tvalue have the same meaning as zvalue, the only difference is that it uses tdistribution rather then normal distribution.
Let’s look at how Tdistribution with different degrees of freedom compares with the normal distribution.
The first thing that catches your eye is that as more we increase the degree of freedom tdistribution become more close to normal distribution. And it has a good sense when you keep in mind the law of large numbers. For interest let’s build a chart that shows the difference between zvalue and tvalue for the fixed significance level of 0.05.
Now let’s try to make some simulations — generate normally distributed population, take a sample, find the sample mean and then find confidence interval. Degrees of freedom will be equal to sample size minus one.