Question: code all in PYTHON n 6.6. Consider the experiment discussed in lecture: take a coin and repeatedly flip it. After n Alips, denote the actual

code all in PYTHON

code all in PYTHON n 6.6. Consider the experiment discussed in lecture:

n 6.6. Consider the experiment discussed in lecture: take a coin and repeatedly flip it. After n Alips, denote the actual (possibly unknown) probability of heads as p and the estimate for the probability of heads after n flips as: kn pin) where kn is the number of heads observed in n flips. (a) Consider n as a variable and plot pln) vs. n for one sequence of flips. Plot at least out to 500 flips. Use p=1/2, but feel free to explore. (b) Repeat the experiment from (a) many times and plot the trajectory of (n) vs. n for these trials all on the same plot. Plot at least 400 trials on the plot. (c) Plot histograms of pln) at fixed n. For example, for n = 2, plot a histogram of p(2) over all the trials from part (b). Plot these histograms for several values of n - e.g., n=2,5,50,500. Explore and experiment. (d) Based on the plots in (b)-(e), describe the behavior of p(n) as n increases. How do the different trials vary around the actual value of p? (e) Use the np.std() command from numpy to compute the sample standard deviation of (n) at fixed n - i.e., call this (n). Specifically, you are computing a measure of the variation from the actual valaue of p over all of the trials from (b)-(e) which is also a measure of the "spread" of the histograms from (c). Plot (n) vs. n. Compare this plot of 1/(2n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!