Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

pls help

  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?

  2. 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?

  3. 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?

  4. 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.

  5. 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

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

ISBN: 1489982175, 978-1489982179

More Books

Students also viewed these Databases questions

Question

8. Demonstrate aspects of assessing group performance

Answered: 1 week ago