Simulating from the geometric distribution
In this exercise you'll compare your replications with the output of rgeom().
यह अभ्यास पाठ्यक्रम का हिस्सा है
Foundations of Probability in R
अभ्यास निर्देश
- Use the function
rgeom()to simulate 100,000 draws from a geometric distributions with probability .2. Save this asgeom_sample. - Compare
replicationsandgeom_samplewith thecompare_histograms()function.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# 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