5
$\begingroup$

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}$$

$\endgroup$
  • 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 '14 at 8:57
  • $\begingroup$ There bare tricks to do binomial distribution calculations with large n (based on relationship to beta distribution) and those trikcs are implemented i R. $\endgroup$ – kjetil b halvorsen Jun 19 '14 at 14:39
0
$\begingroup$

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 Mahemathics known as regularized incomplete beta function.)

$\endgroup$

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.