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

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 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. You hypothesize that the four values occur with these frequencies in the population of shipments.

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

These frequencies are stored in the hypothesized DataFrame.

The incoterm_counts DataFrame stores the .value_counts() of the vendor_inco_term column.

late_shipments is available; pandas and matplotlib.pyplot are loaded with their standard aliases.

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Find the total number of rows in late_shipments.