Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please answer number 4 or 5 !!! 1.We can simulate flipping a coin by generating random numbers from a uniform distribution in [0,1) and considering

please answer number 4 or 5 !!!

1.We can simulate flipping a coin by generating random numbers from a uniform distribution in [0,1) and considering numbers >= 0.5 to be heads.

Do the following in MATLAB:

trials = 100; flip = rand(trials,1); heads = (flip >= 0.5); percentheads = sum(heads)/trials 

What is the relative frequency of heads?

  1. Run the experiment in #1 a total of ten times. What is the lowest relative frequency you get? Why isn't it always 0.5?
  2. Run the experiment ten times each with trial=1000 and with trial=100000. What is happening to the variation of the relative frequency as the number of trials increases? Why?
  3. We can use a random number generator to estimate probabilities that might otherwise be difficult to evaluate. Consider the probability of obtaining four heads on four flips. Generate four separate random experiments of 0s and 1s representing N trials each. (You can do this by generating an Nx4 random array rather than an Nx1 array as in #1.) Now look at the corresponding rows and determine what percentage of the time all four coin flips across a row are heads (all entries equal 1). Show how you do this in MATLAB. Report the percentage with N=10,000 and 100,000, and compare this to the expected percentage.
  4. Suppose the coin is unfair and has a 45% probability of being heads. You want to test this coin by doing 100 coin flips. Modify your code from #1 so that the probability of heads is 0.45. If you repeat this 100-flip experiment over and over, the relative frequency should vary around 0.45. How likely is it that the result will show a fair coin by giving a relative frequency of 50% or higher? Calculate the expected percentage of times this would happen by doing this 100-flip experiment 1000 times and calculating the percentage of time the relative frequency in 100 flips is 50% or higher. Does 100 flips appear to be enough trials to reliably detect an unfair coin with a 45% probability of heads?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

More Books

Students also viewed these Databases questions