Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do the following in MATLAB: trials = 100; flip = rand(trials,1); heads = (flip >= 0.5); percentheads = sum(heads)/trials a.We can use a random number

Do the following in MATLAB:

trials = 100;

flip = rand(trials,1);

heads = (flip >= 0.5);

percentheads = sum(heads)/trials

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

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

please answer these a and b, thanks

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

Advances In Database Technology Edbt 88 International Conference On Extending Database Technology Venice Italy March 14 18 1988 Proceedings Lncs 303

Authors: Joachim W. Schmidt ,Stefano Ceri ,Michele Missikoff

1988th Edition

3540190740, 978-3540190745

More Books

Students also viewed these Databases questions

Question

What are the three components of evidence-based practice?

Answered: 1 week ago