Course Content

Learning Statistics with Python

Calculating Confidence Interval with Python

If we work with small distribution (the size is less or equal to 30) and the distribution approximates the normal, we will use t-statistics.

**How to calculate confidence interval?**

- From
`scipy.stats`

we use the`t.interval()`

function for the Student's T distribution. - As it was before,
`alpha`

means the confidence level. `df`

is the number of**degrees of freedom**.`loc`

is the**mean**.`sem`

is the**standard error**of the sample.

**Degrees of freedom**

The degree of freedom is the number of independent information elements that go into estimating a parameter.

The formula is `N - 1`

, where `N`

is the **sample size**.

Try to change the `alpha`

parameter and observe the changes.

Section 5.

Chapter 6