Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using python Let us consider 1000 voters. Each voter votes yes or no on Proposition X. In this exercise we shall see the fluctuation of

using python

image text in transcribed

Let us consider 1000 voters. Each voter votes yes or no on Proposition X. In this exercise we shall see the fluctuation of the number of yes a. (2 point) Write a function of p E [0,1] generate 1000 II.D. Bernoulli random variables ,k = 1, , 10001 with probabilities P. = 1) = p and P(fi = 0) = 1-p. That is, the input is p and output is , k 1, . . . , 1000} . You should not print all the variables k, k = 1, . . . , 1000} in the output (save time!). This sequence represents the opinions of voters ( = 1 means that the i-th voter says yes, for example) b. (2 point) Using the function in part a, write a function of p e [0, 1] to generate the sequence (Sk := | + . . . + Se , k = 1, . . . , 10001 of sums of these 's. That is, the input is p and output is the sum {Sk := 1 + . . . + Se , k = 1, . . . , 10001 . You should not print all the variables. Sk represents the cumulative counts of yes in the first k voters. C. (3 points) Using the function in part b, draw a (time-series) plot k-Sk/k, k 1, . . . , 1000 of the sample average Sk / k . That is, the x-axis is k = 1, 1000, and the y-axis is Sk for three different values of p = 0.25, 0.5, 0.75 d. (3 points) Compare the plots of three cases p = 0.25, 0.5, 0.75 in part c and describe the similarities and differences

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

Database Support For Data Mining Applications Discovering Knowledge With Inductive Queries Lnai 2682

Authors: Rosa Meo ,Pier L. Lanzi ,Mika Klemettinen

2004th Edition

3540224793, 978-3540224792

More Books

Students also viewed these Databases questions

Question

Discuss the Rights issue procedure in detail.

Answered: 1 week ago

Question

Discuss the Rights issue procedure in detail.

Answered: 1 week ago

Question

Explain the procedure for valuation of shares.

Answered: 1 week ago

Question

Which months of this year 5 Mondays ?

Answered: 1 week ago

Question

Define Leap year?

Answered: 1 week ago