Statistics: Confidence interval for the mean(sigma not known)

This is part of the course “Probability Theory and Statistics for Programmers”.

Probability Theory and Statistics For Programmers

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.


Let’s look at differences in inequalities for confidence intervals when we know sigma and when we don’t.

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.

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.

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.

Reach the next level of focus and productivity with





Indie hacker behind More at

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Resources to Practice Data Engineering

A graph on a computer.

5 Window Function Examples to Take Your SQL Skills to the Next Level

Statistics: Hypothesis testing basics

Interactive Machine Learning: Make Python ‘Lively’ Again

What is Data Blending in Tableau?

Making Data Collaboration More Systematic, Responsible, Sustainable

GA COVID-19 Report August 11, 2021

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Radzion Chachura

Radzion Chachura

Indie hacker behind More at

More from Medium

P -Value ( Is it that Important or Not?)

R-Programming: Logistic and Poisson regression

Checking your linear regression assumptions and how to check them

Simple Linear Regression in R