Confidence Interval for the Mean(Sigma Not Known) with Python

main

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.

draw

The differences are:

  1. we use sample sigma rather than population sigma

  2. we use t-value rather than z-value

We already knew how to find sample variance. But how to find t-value?

T-value have the same meaning as z-value, the only difference is that it uses t-distribution rather then normal distribution.

Let’s look at how T-distribution with different degrees of freedom compares with the normal distribution.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

The first thing that catches your eye is that as more we increase the degree of freedom t-distribution 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 z-value and t-value for the fixed significance level of 0.05.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

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.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.