Aan de slagGa gratis aan de slag

Performing a chi-square test

The chi-square independence test compares proportions of successes of one categorical variable across the categories of another categorical variable.

Trade deals often use a form of business shorthand in order to specify the exact details of their contract. These are International Chamber of Commerce (ICC) international commercial terms, or incoterms for short.

The late_shipments dataset includes a vendor_inco_term that describes the incoterms that applied to a given shipment. The choices are:

  • EXW: "Ex works". The buyer pays for transportation of the goods.
  • CIP: "Carriage and insurance paid to". The seller pays for freight and insurance until the goods board a ship.
  • DDP: "Delivered duty paid". The seller pays for transportation of the goods until they reach a destination port.
  • FCA: "Free carrier". The seller pays for transportation of the goods.

Perhaps the incoterms affect whether or not the freight costs are expensive. Test these hypotheses with a significance level of 0.01.

\(H_{0}\): vendor_inco_term and freight_cost_group are independent.

\(H_{A}\): vendor_inco_term and freight_cost_group are associated.

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

Deze oefening maakt deel uit van de cursus

Hypothesis Testing in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Proportion of freight_cost_group grouped by vendor_inco_term
props = ____

# Print props
print(props)
Code bewerken en uitvoeren