Search⌘ K

Sampling

Explore the fundamentals of sampling and its role in statistical inference. This lesson helps you understand sampling variation and the impact of sample size. Through practical activities and visualizations in R, you will learn to estimate proportions and grasp randomness in repeated samples.

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.

R
library(tidyverse)
library(moderndive)

Sampling bowl activity

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

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 = ...