1. Learn
  2. /
  3. Courses
  4. /
  5. Hypothesis Testing in R

Exercise

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.

Instructions 1/4

undefined XP
  • 1
    • Using the late_shipments dataset, get counts by the freight_cost_group columns.
    • Insert a suitable number to inspect whether the counts are "big enough" for a two sample t-test.
  • 2
    • Using the late_shipments dataset, get counts by the late column.
    • Insert a suitable number to inspect whether the counts are "big enough" for a one sample proportion test.
  • 3
    • Using the late_shipments dataset, get counts by the vendor_inco_term and freight_cost_group columns.
    • Insert a suitable number to inspect whether the counts are "big enough" for a chi-square independence test.
  • 4
    • Using the late_shipments dataset, get counts by the shipment_mode column.
    • Insert a suitable number to inspect whether the counts are "big enough" for an ANOVA test.