use simulations to prove that the binomial distribution is correct.

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter12: Review Of Calculus And Probability
Section12.5: Random Variables, Mean, Variance, And Covariance
Problem 5P
icon
Related questions
Question

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 "vectorized" as possible without the use of loops*

*limit n<=15, 0.4<=p<=0.6, and r>=1,000,000*

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Random variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole