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.
Bu egzersiz
Hypothesis Testing in R
kursunun bir parçasıdırUygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# Get counts by freight_cost_group
counts <- ___
# See the result
counts
# Inspect whether the counts are big enough
all(counts$n >= ___)