search for: rbinomr

Displaying 1 result from an estimated 1 matches for "rbinomr".

Did you mean: rbinom
2013 May 23
1
sample(c(0, 1)...) vs. rbinom
...xhibits the problem ================================================= ppp <- seq(0, 1, by = 0.01) result <- do.call(rbind, lapply(ppp, function(p) { ??? set.seed(1) ??? sampleRes <- sample(c(0, 1), size = 1, replace = TRUE, ??????????????????????? prob=c(1-p, p)) ?? ? ??? set.seed(1) ??? rbinomRes <- rbinom(1, size = 1, prob = p) ?? ? ??? data.frame(prob = p, equivalent = all(sampleRes == rbinomRes)) ?? ? })) result Appendix B: the output from the R code ====================================== ??? prob equivalent 1?? 0.00?????? TRUE 2?? 0.01?????? TRUE 3?? 0.02?????? TRUE 4?? 0.03???...