Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose you decide to use the number of wins as your test statistic. Question 4. Write a function called simulate that generates exactly one simulated

image text in transcribed
Suppose you decide to use the number of wins as your test statistic. Question 4. Write a function called simulate that generates exactly one simulated value of your test statistic under the null hypothesis. It should take no arguments and simulate 20 games under the assumption that the result of each game is sampled from a fair coin (one that lands heads or lands tails with 50% chance). Your function should return the number of wins in those 20 games. Hint: You may nd the textbook section under-themodel)_ on the sample_proportions function to be useful. In [21]: fair_coin = [.5, .5] def simulatel): return sample_proportions(28, fair_coin)[0]*28 # call your function to make sure it works simulate() Out[21]: 11.0 In [22]: ok.grade(\"q2_4"}; ~~~H~~~~~~~H ~~~~ ~~~~ ~~~~~~~~H ~~~H~~~H~~~~ ~~~~ ~~~~ ~~~~~~~H~~~P ~~~~ ~~~~ Test summary Passed: 1 Failed: B [ooooooooook] 160.6% passed for i in np.arange(repetitions): test_statistics_under_nu11 = np.append(test_statistics_under_nu11 . simulate()} testistatisticsiunderinull

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Contemporary Mathematics

Authors: OpenStax

1st Edition

1711470554, 978-1711470559

Students also viewed these Mathematics questions