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

Exercise

Wilcoxon-Mann-Whitney

Another class of non-parametric hypothesis tests are called rank sum tests. Ranks are the positions of numeric values from smallest to largest. Think of them as positions in running events: whoever has the fastest (smallest) time is rank 1, second fastest is rank 2, and so on.

By calculating on the ranks of data instead of the actual values, you can avoid making assumptions about the distribution of the test statistic. It's more robust in the same way that a median is more robust than a mean.

One common rank-based test is the Wilcoxon-Mann-Whitney test, which is like a non-parametric t-test.

late_shipments is available, and the following packages have been loaded: pingouin and pandas as pd.

Instructions

100 XP
  • Select weight_kilograms and late from late_shipments, assigning the name weight_vs_late.
  • Convert weight_vs_late from long-to-wide format, setting columns to 'late'.
  • Run a Wilcoxon-Mann-Whitney test for a difference in weight_kilograms when the shipment was late and on-time.