ANOVA
既然你已經用 Levene 檢定確認變異數相等,並且用視覺化方式評估了對數轉換後薪資的大致常態性,現在就該進行 ANOVA 檢定了!回想一下,ANOVA 檢定的目的是判斷生技、企業軟體與醫療保健公司的平均募資額是否相同。因為這三個群組符合 ANOVA 的前提條件,你可以信任檢定結論的有效性。
你先前建立的 DataFrame(biotech_df、enterprise_df 與 health_df)都已為你載入。pandas 已以 pd 載入、NumPy 以 np 載入、Matplotlib 以 plt 載入,另外也已載入 SciPy 的 stats 套件。你在前一個練習中計算的募資金額對數轉換結果也已提供給你使用。
本練習屬於課程
Python 推論基礎
練習說明
- 使用三個對數轉換後的募資額,依下列引數順序進行單因子 ANOVA 檢定:Biotechnology、Enterprise Software、Health Care。
- 列印出當 p 值在 5% 顯著水準下為顯著時的結果。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
biotech_log_funding = np.log(biotech_df['funding_total_usd'])
enterprise_log_funding = np.log(enterprise_df['funding_total_usd'])
health_log_funding = np.log(health_df['funding_total_usd'])
# Conduct a one-way ANOVA test to compare the log-funding
s, p_value = ____
# Print if the p-value is significant at 5%
____