In: Statistics and Probability
Now let's use Bayes' theorem and the binomial distribution to address a Bayesian inference question. You toss a bent coin N times, obtaining a sequence of heads and tails. The coin has an unknown bias f of coming up heads. (a) If NH heads have occurred in N tosses, what is the probability distribution of f? Assume a uniform prior P(f) = 1 and make use of the following result: integral 0 to 1 f^a (1 - f)^b df = a!b! / (a + b + 1)! (b) Using MATLAB Sketch (or plot) the shape of the probability distribution of f for N = 5 and NH = 2
%%%%%%%%% Matlab Code %%%%%%%%%%%%%%%%%
f=0:0.0001:1;
density=10.*(f.^2).*((1-f).^3);
plot(f, density);
%%%%%%%%%% Plot of the distribution %%%%%%%%%%%%