開始使用免費開始

在較小 n 下比較常態與二項分配

當我們拋「很多」次硬幣時,常態分配看起來相當接近真實情況。那如果只拋 10 次,而且正面機率仍是 20% 呢?常態近似還適用嗎?

本練習屬於課程

R 的機率基礎

檢視課程

練習說明

  • 產生 100,000 個來自 Binomial(10, .2) 分配的樣本,並將結果存成 binom_sample
  • 使用 rnorm() 產生 100,000 個近似此二項分配的常態分配樣本,並將結果存成 normal_sample
  • 使用 compare_histograms() 比較這兩個分配。(記得它需要兩個引數:要比較的兩個樣本。)

動手互動練習

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

# Draw a random sample of 100,000 from the Binomial(10, .2) distribution
binom_sample <-

# Draw a random sample of 100,000 from the normal approximation
normal_sample <- 

# Compare the two distributions with the compare_histograms function
編輯並執行程式碼