course content

Course Content

Data Science Interview Challenge

Challenge 4: Confidence IntervalsChallenge 4: Confidence Intervals

In the realm of statistics, confidence intervals provide a range within which a population parameter is likely to fall. They offer a degree of certainty around a sample statistic. For example, if you survey a group of people about their height, and compute an average height of 170 cm with a 95% confidence interval of (168 cm, 172 cm), this suggests that you're 95% confident that this range would cover the real height of the entire population.


In this exercise, leveraging a random sample data set, you'll:

  1. Compute the sample mean and the standard error.
  2. Determine the 95% confidence interval for the mean of the sample data.
Code Description

Computes the average of the sample_data.


Calculates the standard error of the sample_data, which measures the amount of variation in the sample mean if you were to draw multiple samples.

t.ppf((1 + confidence_level) / 2., degrees_freedom)

Determines the critical t value based on the desired confidence level and degrees of freedom. This value is used to compute the margin of error, which is then added and subtracted from the sample mean to obtain the confidence interval.

Everything was clear?

Section 6. Chapter 4
toggle bottom row