Starting with a Binomial Distribution with parameters $n=1000, p=0.5$ and measured successes of 300, I would like to test whether there is a significant difference between success and failure.

The obvious solution (using R):

n1 <- 300
n2 <- 700
p <- 0.5
binom.test(n1, n1+n2, p, alternative='two.sided')

I also want to use the similarity of the Binomial and Normal Distribution for "large" numbers of observations. A trivial solution may be this:

t.test(c(rep(0, n1), rep(1, n2)), mu=p, alternative='two.sided')

Properties of a Normal Distribution based on a Binomial Distribution can be calculated directly:

mu <- (n1+n2)*p
sig2 <- p*(1-p)*(n1+n2)

Therefore it should be possible to simply apply a one-sample t-test. After some trial-and-error I got this solution:

t <- (n2-mu)/sqrt(sig2)
p.value <- 2*abs(1-pt(abs(t), n1+n2-1))

Luckily the results are rather similar.

I do not understand why the t-test stated for example in Wikipedia, where an additional $\sqrt{n_1+n_2}$ is used, does not produce the right result:

t.wrong <- sqrt(n1+n2)*(n2-mu)/sqrt(sig2)

Why do I have to omit this part of the tests formula?

  • $\begingroup$ Where on wikipedia does your t.wrong equation come from? $\endgroup$
    – John
    Commented Nov 7, 2012 at 22:36
  • $\begingroup$ en.wikipedia.org/wiki/Student%27s_t-test#One-sample_t-test The notation is a bit different, but its basically the same. $\endgroup$
    – FloE
    Commented Nov 7, 2012 at 22:41
  • $\begingroup$ You're mixing equations for the proportion, the results from your binom.test and t.test calls; and versions that estimate the number of successes. If you do the equations for proportions when you try to hand do the t-test (mu = 0.5, p-m, etc.), you should be able to figure this out. $\endgroup$
    – John
    Commented Nov 8, 2012 at 2:29
  • $\begingroup$ a*b/c == b/(c/a) --> it's really the same and does not matter. The German Wikipedia in fact uses this equivalent formula: de.wikipedia.org/wiki/… (look at the equation "T=") $\endgroup$
    – FloE
    Commented Nov 8, 2012 at 8:22
  • 1
    $\begingroup$ There's number of things wrong here, but I'll just mention one for the moment. To get a t distribution requires independence of the numerator and denominator. You don't have that, so you have no solid basis for using a t-test. On the other hand, under the null, you know $\sigma$, so you do have a basis for an asymptotic z-test. $\endgroup$
    – Glen_b
    Commented Dec 13, 2013 at 3:00

1 Answer 1


The Wiki one is talking about the sample mean. But here you only have one sample, that is 700 for binomial (N=1000). Do not confuse the binomial parameter N with your sample size.

  • $\begingroup$ Well, in fact, the binomial parameter $n$ is a sample size ... for the $n$ Bernoulli trials that the binomial is the sum of. $\endgroup$
    – Glen_b
    Commented Dec 13, 2013 at 2:55

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.