開始使用免費開始

平均數的效果量

許多獲得創投(venture capital)支持的公司會拿到超過 1 輪的募資。一般而言,第 2 輪會比第 1 輪金額更高。那麼,輪次對平均募資金額的影響究竟有多大?你可以用 Cohen's d 來量化。

回顧一下,計算 Cohen's d 前,必須先計算合併標準差。其公式為:

接著,Cohen's d 為:

我們已為你載入了創投投資的 DataFrame(investments_df),以及 pandas(作為 pd)、NumPy(作為 np)與 SciPy 的 stats。欄位 funding_total_usd 表示該輪收到的總募資金額。

本練習屬於課程

Python 推論基礎

檢視課程

練習說明

  • 分別篩選出 investments_df 中 funding_rounds 為 1 與 2 的資料。
  • 計算各輪的標準差與樣本數。
  • 計算兩輪之間的合併標準差。
  • 使用剛計算出的量來計算 Cohen's d。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Select all investments from rounds 1 and 2 separately
round1_df = investments_df[____['funding_rounds'] == ____]
round2_df = investments_df[____['funding_rounds'] == ____]

# Calculate the standard deviation of each round and the number of companies in each round
round1_sd = ____.std()
round2_sd = ____.std()
round1_n = ____.shape[0]
round2_n = ____.shape[0]

# Calculate the pooled standard deviation between the two rounds
pooled_sd = np.sqrt(((____ - 1) * ____ ** 2 + (____ - 1) *____ ** 2) / (____ + ____ - 2))

# Calculate Cohen's d
d = (____.mean() - ____.mean()) / ____
編輯並執行程式碼