Get startedGet started for free

Confidence interval

The confidence interval is a range in which we suspect the population's mean to land.

You may expect questions on confidence intervals if your future project touches behavioral or medical science, politics, or advertising.

In this exercise, you'll practice computing confidence intervals using the sleep dataset from the datasets package. The dataset contains data on the effect of two drugs on ten patients. The effect is measured as an increase in hours of sleep compared to control, which is stored in the extra column.

A confidence interval is stored in the conf.int component of an object created with t.test().

You can retrieve it like this:

t.test(x)$conf.int

Watch out! To run a t-test, your data needs to be normally distributed.

This exercise is part of the course

Practicing Statistics Interview Questions in R

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise