Session Ready
Exercise

Visualizing goodness of fit

The chi-square goodness of fit test compares proportions of each level of a categorical variable to hypothesized values. Before running a such a test, it can be helpful to visually compare the distribution in the sample to the hypothesized distribution.

Recall the vendor incoterms in the late_shipments dataset. Let's hypothesize that the four values occur with these frequencies in the population of shipments.

  • EXW: 0.75
  • CIP: 0.05
  • DDP: 0.1
  • FCA: 0.1

late_shipments is available; tibble, dplyr, ggplot2, and infer are loaded.

Instructions 1/2
undefined XP
  • 1
  • 2
  • Using the late_shipments dataset, count the vendor_inc_terms.
  • Get the number of rows in late_shipments.
  • Add a column, n to the tibble being defined, containing hypothesized counts for each category.