10.13 Exercises
Use the grid method with other priors; for example, try with
prior = (grid <= 0.5).astype(int)
orprior = abs(grid - 0.5)
, or try defining your own crazy priors. Experiment with other data, such as increasing the total amount of data or making it more or less even in terms of the number of heads you observe.In the code we use to estimate π, keep
N
fixed and re-run the code a couple of times. Notice that the results are different because we are using random numbers, but also check that the errors are more or less in the same order. Try changing the number ofN
points and re-run the code. Can you guesstimate how the number of N points and the error are related? For a better estimation, you may want to modify the code to compute the error as a function ofN
. You can also run the code a few times with the sameN
and compute the mean error and standard deviation of the error. You can plot these results using theplt.errorbar()
function from Matplotlib. Try using...