Sampling

Learn about sampling and develop an understanding through practical demonstrations.

In this lesson, we begin the third portion of this course on statistical inference by learning about sampling. The concepts behind sampling form the basis of confidence intervals and hypothesis testing, We’ll see that the tools we’ve learned related to data visualization and data wrangling will also play an important role in the development of our understanding.

Needed packages

Let’s load all the packages needed for the coming programs.

Press + to interact
library(tidyverse)
library(moderndive)

Sampling bowl activity

Let’s start with a hands-on activity. What proportion of this bowl’s balls are red?

Press + to interact
A bowl with red and white balls
A bowl with red and white balls

One way to answer this question will be to perform an exhaustive count. This will include removing each ball individually, counting the number of red balls and the number of white balls, and dividing the number of red balls by the total number of balls. However, this will be a long and tedious process.

Using the shovel once

Instead of performing an exhaustive count, let’s insert a shovel into the bowl, and using the shovel, let’s remove 5 * 10 = 50 balls, as seen in the figure below.

Inserting a shovel into the bowl
Inserting a shovel into the bowl
Removing 50 balls from the bowl
Removing 50 balls from the bowl

Observe that 17 of the balls are red and therefore, 0.34 = ...