4
$\begingroup$

I have seen many questions on this topic, but none of them could answer my question. Suppose I flip a coin 1,000 times and got 490 heads. I want to test if the coin is fair. I don't want to use the binomial distribution but instead I'd like to use the normal approximation. I want to test $H_0: p = 0.5$ vs $H_1 : p \neq 0.5$.

If I use the t-test, I would have to estimate the sample variance, and the reason for using a t-test would be that I don't know the population variance.

However, is it actually true that I don't know the population variance? I'm supposed to compute a test statistic, assuming that null is true. If I assume the null is true, I do know the population variance, because I know $p$ (because I assume $p = 0.5$). I should then use the z test.

Which test should I use, and why?

$\endgroup$

2 Answers 2

4
$\begingroup$

Use the z test.

In the case where you assume the binomial parameter is $p=p_0$, then the variance would be determined since it is a function of the binomial parameter. If I recall correctly, the resulting test statistic would be a score statistic.

In the case where you use the estimated binomial parameter in the variance (resulting in a Wald statistic if I remember correctly, though I might have permuted those) you would still use a z test because the variance is determined by the estimate of the binomial parameter.

$\endgroup$
8
  • $\begingroup$ I think you got them reversed. The default in R for logistic regression is to use a z-test on the coefficients, and I’m pretty sure that’s a Wald test (though I am open to being wrong about this). $\endgroup$
    – Dave
    Commented Jun 30, 2021 at 3:49
  • $\begingroup$ @Dave Nope, just checked. A Wald test statistic uses the estimated sample mean in the variance computation. A score statistic uses the variance under the null. I would derive these in my answer but its quite late here. $\endgroup$ Commented Jun 30, 2021 at 3:53
  • $\begingroup$ I’ll have to check out if the R default is Wald. I always thought it was, but now I wonder if it is a score test. $\endgroup$
    – Dave
    Commented Jun 30, 2021 at 3:57
  • $\begingroup$ If I were to use the sample variance instead of the population variance, wouldn't I end up with a t statistic? $\endgroup$ Commented Jun 30, 2021 at 14:19
  • $\begingroup$ @user1691278 no, because the sample variance is a function of the sample mean. You don't have to estimate it independently and hence no additional error is introduced. $\endgroup$ Commented Jun 30, 2021 at 14:24
2
$\begingroup$

In R, an exact binomial test binom.test of $H_0: p= 1/2$ vs. $H_a: p\ne 1/2$ fails to reject $H_0$ with P-value $0.5479727.$ The second R statement below shows how the P-value is computed using binomial CDFs pbinom.

binom.test(490,1000, 1/2)$p.val
[1] 0.5479727
pbinom(490, 1000, .5) + 1 - pbinom(509, 1000, .5)
[1] 0.5479727

Also, prop.test, which uses a normal approximation gives P-value $0.5479514.$ The second R statement shows how the approximate P-value can be computed using normal CDFs pnorm, with continuity correction.

prop.test(490,1000, 1/2)$p.val
[1] 0.5479514
2*pnorm(490.5, 500, sqrt(250))
[1] 0.5479514

I don't understand your aversion to exact binomial tests, but for $n$ in the hundreds or thousands, there will be very little difference using normal approximations--especially when hypothetical $p \approx 1/2.$

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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