Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 [0,1] generate 1000 L.I.D. Bernoulli random variables |&, k = 1, , 1000} with probabilities PG = 1) = p and PG = 0) = 1-p. That is, the input is p and output is {5k , k - 1,...,1000}. You should not print all the variables , k - 1,...,1000} in the output (save time!). This sequence represents the opinions of voters (Ec-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 := 1 + +Se, k = 1, , 1000} of sums of these 's. That is, the input is p and output is the sum (Sk-1 . . k-1, .. . , 1000} . 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 0.25, 0.5, 0.75 in part c and describe the d. (3 points) Compare the plots of three cases p similarities and differen ces
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started