Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code in python 6.6. Consider the experiment discussed in lecture: take a coin and repeatedly flip it. After n flips, denote the actual (possibly unknown)
code in python
6.6. Consider the experiment discussed in lecture: take a coin and repeatedly flip it. After n flips, denote the actual (possibly unknown) probability of heads as p and the estimate for the probability of heads after n flips as: kn p(n) = n where kn is the number of heads observed in n flips. = = (a) Consider n as a variable and plot (n) 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 p(n) vs. n for these trials all on the same plot. Plot at least 400 trials on the plot. (c) Plot histograms of (n) at fixed n. For example, for n = 2, plot a histogram of (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)-(c), 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)-(c) which is also a measure of the "spread of the histograms from (c). Plot (n) vs. n. Compare this plot of 1/(2vn)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