In some circumstances the Chi-square test can be replaced by a test based on the binomial distribution. The common issue with using the binomial distribution is that it may quickly become tricky to calculate big factorials. However, one can easily use Stirling's approximation in order to approximate such function. My question is: What test is it best to use then?

For example, I flip a coin and count the number of heads and the number of tails. I get 4519 heads and 4456 tails. Is my coin fair? Which test will give me the most trustful p.value, the chi-squared test or a test based on the binomial distribution (using Stirling approximation for ease of calculation)?

$$\chi ^2 = \frac{4456 - \frac{4456+4519}{2}}{4456+4519} + \frac{4519 - \frac{4456+4519}{2}}{4456+4519} $$

$$P(X < 4519) = \sum_{i=0}^{4519}{ {4456+4519} \choose {i} }0.5^{4456+4519}$$

  • 1
    $\begingroup$ In such large samples it makes almost no difference which you use. However, your chi-square statistic looks wrong. $\endgroup$
    – Glen_b
    Jun 19, 2014 at 8:57

1 Answer 1


You don't need the Stirling approximation to compute the CDF (cumulative distribution function) of the binomial distribution. There is a relationship to the Beta distribution Wikipedia. If $X \sim \mathcal{Binom}(n,p)$ then $$ \DeclareMathOperator{\P}{\mathbb{P}} \P(X \le k)=\mathcal{I}(n-k,k+1) $$ so is expressed via the CDF of a Beta-distributed random variable (in mathematics, known as the regularized incomplete beta function.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.