開始使用免費開始

兩個 Poisson 變數的和

Poisson 分配有個很實用的性質:當你把多個 Poisson 分配相加,結果仍然是 Poisson 分配。

在這裡你會產生兩個 Poisson 隨機變數來驗證這件事。

本練習屬於課程

R 的機率基礎

檢視課程

練習說明

  • 從 Poisson(1) 分配模擬 100,000 次抽樣,並將結果存為 X
  • 另行從 Poisson(2) 分配模擬 100,000 次抽樣,並將結果存為 Y
  • XY 相加,建立變數 Z
  • 我們預期 Z 會遵循 Poisson(3) 分配。使用 compare_histograms 函式,將 Z 與來自 Poisson(3) 的 100,000 次抽樣進行比較。

動手互動練習

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

# Simulate 100,000 draws from Poisson(1)


# Simulate 100,000 draws from Poisson(2)


# Add X and Y together to create Z


# Use compare_histograms to compare Z to the Poisson(3)
編輯並執行程式碼