Function that generates and displays m repeated samples of n Bernoulli trials with a given probability of success.
bino.gen(samples, n, pi)
samples | number of repeated samples to generate |
---|---|
n | number of Bernoulli trials |
pi | probability of success for Bernoulli trial |
Simulated binomial distribution
Theoretical binomial distribution
bino.gen(1000, 20, 0.75)#> $simulated.distribution #> Successes #> 0 1 2 3 4 5 6 7 8 9 10 11 #> 0.005 0.018 0.061 0.140 0.211 0.176 0.170 0.118 0.051 0.035 0.010 0.005 #> #> $theoretical.distribution #> 0 1 2 3 4 5 6 7 8 9 10 11 12 #> 0.003 0.021 0.067 0.134 0.190 0.202 0.169 0.112 0.061 0.027 0.010 0.003 0.001 #> 13 14 15 16 17 18 19 20 #> 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 #>