Binomial distribution and negative binomial distribution
In our first experiment, the binomial distribute is used, the pdf of it is
\begin{displaymath}f(x;n,p) = \Pr(X = x) = C_n^x p^x(1-p)^{n-x}\end{displaymath}
where x is the number of heads and n is the total number of tossing. In our case, n=12. To calculate p-value, we need to calculate f(0, 12, p=.5), f(1,12,p=.5), f(2,12,p=.5), and f(3, 12, p=.5).
\begin{displaymath}f(0, 12, p=.5) = C_{12}^0 p^0 (1-p)^{12-0}=C_{12}^0 .5^{12}\end{displaymath}
For the second experiment, the data y follows a negative binomial distribution (a generalization of geometric distribution), the pdf of it is
\begin{displaymath}f(y;r,p) = C_{r-1}^{y-1} p^r (1-0)^{y-r}\end{displaymath}
where y is the total number of tossing and r is the number of heads. In our case, r=3. To calculate the p-value, we need to calculate f(11; 3, .5), …, f(3;3,.5) (Note that we need at least 3 tossings).
\begin{displaymath}f(11; 3 ,.5) = C_{11-1}^{3-1}.5^3 .5^8 = C_{10}^2 .5^{11}\end{displaymath}
