Solved-Binomial Distribution -Solution

$30.00 $19.00

Exercise 1 Generate 100 experiments of flipping 10 coins, each with 30% probability. What is the most common number? Why? Binomial Distribution has two parameters: ~ ( , ) Size= number of coin flips p= the probability of seeing one head in a coin flip Random variable denotes number of heads. We flip a fair…

You’ll get a: . zip file solution

 

 

Description

5/5 – (2 votes)

Exercise 1

  • Generate 100 experiments of flipping 10 coins, each with 30% probability.

  • What is the most common number? Why?

  • Binomial Distribution has two parameters:

    • ~ ( , )

    • Size= number of coin flips

    • p= the probability of seeing one head in a coin flip

    • Random variable denotes number of heads.

  • We flip a fair coins 10 times. What is the probability of seeing 5 heads?

  • ~ 10, . 5

  • Pr = 5 ?

  • We flip a fair coins 10 times. What is the probability of seeing 5 heads?

Simulation:

  • Repeat this experiment 100,000 times: “number of draws=100,000”

  • flips <- rbinom(100000,10,.5)

  • flips contains 100000 numbers, each between 0 and 10 (number of heads).

  • mean(flips == 5), returns percentage of number “5” among 100000 numbers.

The result is 0.24769.

  • dbinom(5,10,.5) returns probability of seeing 5 heads out of 10 tosses, for a fair coin using exact calculation.

  • Note that if you re-run it, you will get the same result.

  • As you can see, the result of exact calculation is 0.2460938 which is very close to the result of our simulation 0.24769

If ~ 10, . 5 , then

dbinom(k,10,.5) returns Pr = = ( )

Exercise 2

  • If you flip 10 coins each with a 30% probability of coming up heads, what is the probability exactly 2 of them are heads?

  • Compare your simulation with the exact calculation.

Exercise 3

  • For exercise 2,

  • Part a) use 10000 experiments and report the result.

  • Part b) use 100000000 experiments and report the result.

  • Compare the result of part a and part b, with the exact calculation. What is your conclusion?

If ~ 10, . 5 , what is the E[ ]? using calculation E = 5.

  • Simulation: run the experiment 100,000 times.

  • flips <- rbinom (100000, 10, .5 )

  • mean (flips): the average number of heads

Result of simulation is close to 5

If ~ 100, . 2 , what is the E[ ]? using calculation E = 20.

  • Simulation: run the experiment 100,000 times.

  • flips <- rbinom (100000, 100, .2 )

  • mean (flips): the average number of heads

Result of simulation is close to 20

Exercise 4

  • What is the expected value of a binomial distribution where 25 coins are flipped, each having a 30% chance of heads?

  • Compare your simulation with the exact calculation.

If ~ 10, . 5 , what is the Var[ ]? using calculation Var =2.5.

  • Simulation: run the experiment 100,000 times.

  • X <- rbinom (100000, 10, .5 )

  • var(X): the variance

Result of simulation is close to 2.5

If ~ 100, . 2 , what is the Var[ ]? using calculation Var = 16.

  • Simulation: run the experiment 100,000 times.

  • X <- rbinom (100000, 100, .2 )

  • var(X): the variance

Result of simulation is close to 16

Exercise 5

  • What is the variance of a binomial distribution where 25 coins are flipped, each having a 30% chance of heads?

  • Compare your simulation with the exact calculation.