use simulations to prove that the binomial distribution is correct.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education