Function that generates and displays m repeated samples of n Bernoulli trials with a given probability of success
bino.gen(samples = 10000, n = 20, pi = 0.5)
number of repeated samples to generate
number of Bernoulli trials
probability of success for each Bernoulli trial
simulated.distribution
Simulated binomial distribution
theoretical.distribution
Theoretical binomial distribution
bino.gen(samples=50000, n = 10, pi = 0.80)
#> $simulated.distribution
#> Successes
#> 2 3 4 5 6 7 8 9 10
#> 0.000 0.001 0.006 0.027 0.089 0.202 0.304 0.264 0.107
#>
#> $theoretical.distribution
#> 0 1 2 3 4 5 6 7 8 9 10
#> 0.000 0.000 0.000 0.001 0.006 0.026 0.088 0.201 0.302 0.268 0.107
#>