幾何分布からのシミュレーション
この演習では、replications を rgeom() の出力と比較します。
この演習はコースの一部です
Rで学ぶ確率の基礎
演習の手順
- 関数
rgeom()を使って、成功確率が 0.2 の幾何分布から 100,000 回の乱数を生成し、geom_sampleとして保存します。 compare_histograms()関数でreplicationsとgeom_sampleを比較します。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Replications from the last exercise
replications <- replicate(100000, which(rbinom(100, 1, .2) == 1)[1])
# Generate 100,000 draws from the corresponding geometric distribution
geom_sample <- rgeom(___)
# Compare the two distributions with compare_histograms