Get startedGet started for free

Testing sample size

In order to conduct a hypothesis test, and be sure that the result is fair, a sample must meet three requirements: it is a random sample of the population; the observations are independent; and there are enough observations. Of these, only the last condition is easily testable with code.

The minimum sample size depends on the type of hypothesis tests you want to perform. Let's test some scenarios on the late_shipments dataset.

late_shipments is available; dplyr is loaded.

This exercise is part of the course

Hypothesis Testing in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Get counts by freight_cost_group
counts <- ___


# See the result
counts

# Inspect whether the counts are big enough
all(counts$n >= ___)
Edit and Run Code