use simulations to prove that the binomial distribution is correct.
In R, you will use simulations to prove that the binomial distribution is correct. Recall that the binomial distribution has two parameters n and p. There are n trials and each has two possible outcomes, with probability p for “success” and 1-p for “failure”. The binomial gives the probability distribution for the number of successes in n trials. You will conduct simulations with r replicates, where each simulation replicates does n simulated “coin flips”. You will add up the number of successes in each coin flip, and compare the result to the true distribution:
- Generate n*r values from the uniform(0,1) distribution and arrange these in an rxn matrix. Each value less than p is considered a “success”.
- For each row from part I, count the number of successes. The number of possible successes ranges from 0 to n.
- Use the table function in R and the value_counts function in Python and to count up the number of replicates with each number of successes.
- Make a table that compares the simulation result to the true binomial
probabilities
*Make calculations as "
*limit n<=15, 0.4<=p<=0.6, and r>=1,000,000*
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images