執行適合度檢定(goodness of fit)
vendor_inco_term 的長條圖顯示,四個類別的分佈與你所假設的分佈相當接近。你需要執行「卡方適合度檢定」(chi-square goodness of fit test),來判斷這些差異在統計上是否顯著。
回顧此類檢定的假設:
$H_{0}$:樣本符合假設的分佈。
$H_{A}$:樣本不符合假設的分佈。
為了決定要選擇哪個假設,我們將顯著水準設為 0.1。
上一題的 late_shipments、incoterm_counts 與 hypothesized 已可使用。已載入 scipy.stats 的 chisquare。
本練習屬於課程
Python 中的假設檢定
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Perform a goodness of fit test on the incoterm counts n
gof_test = ____
# Print gof_test results
print(gof_test)