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.
Cette activité fait partie du cours
Hypothesis Testing in R
Exercice interactif pratique
Essayez cet exercice en complétant ce code d’exemple.
# Get counts by freight_cost_group
counts <- ___
# See the result
counts
# Inspect whether the counts are big enough
all(counts$n >= ___)