Performing a goodness of fit test
The bar plot of vendor_inco_term
suggests that the distribution across the four categories was quite close to the hypothesized distribution. You'll need to perform a chi-square goodness of fit test to see whether the differences are statistically significant.
Recall the hypotheses for this type of test:
\(H_{0}\): The sample matches with the hypothesized distribution.
\(H_{A}\): The sample does not match with the hypothesized distribution.
To decide which hypothesis to choose, we'll set a significance level of 0.1
.
late_shipments
, incoterm_counts
, and hypothesized
from the last exercise are available. chisquare
from scipy.stats
has been loaded.
This exercise is part of the course
Hypothesis Testing in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Perform a goodness of fit test on the incoterm counts n
gof_test = ____
# Print gof_test results
print(gof_test)