I am trying to understand the independent t-test formula. It is to test if A and B have the same mean, assuming A and B have the same variance. The t is calculated by the following formula:

$A = A_1, A_2, A_3, ..., A_{n_A}$

$B = B_1, B_2, B_3, ..., B_{n_B}$

$S = \frac{(n_A-1)s_A^2+(n_B-1)s_B^2}{n_A+n_B-2}$

$t = \frac{m_A - m_B}{\sqrt{\frac{S}{n_A}+\frac{S}{n_B}}}$

Is it possible to use the unbiased variance of A + B instead of the $S$?

$A + B = A_1, A_2, A_3, ..., A_{n_A}, B_1, B_2, B_3, ..., B_{n_B}$

  • 1
    $\begingroup$ Reconsider your premises: That $s^{2}$ in your post is an unbiased estimate of the variance, for two groups that might have different means. $\endgroup$
    – Glen_b
    Oct 3 at 23:27
  • $\begingroup$ Thank you for pointing it out. What should I use? Tried using $S$ for now $\endgroup$
    – Jihyun
    Oct 4 at 0:54
  • 1
    $\begingroup$ I don't understand your question. What's the problem with using $s^2$? $\endgroup$
    – Glen_b
    Oct 4 at 1:04

1 Answer 1


It's a bad idea. If the means in the two groups are different, the variance computed from the two groups combined will include the between-group variation and so will be larger than the true within-group variance $s^2$.

For example: two groups of size 30, where A has mean 0 and B has mean 5

> a<-rnorm(30)
> b<-rnorm(30,mean=5)
> var(a)
[1] 0.5855081
> var(b)
[1] 0.858661
> var(c(a,b))
[1] 7.901566

Under the null hypothesis you would still get an unbiased estimator of $s^2$, but when the null is false you will overestimate $s^2$ and so lose power compared to the standard $t$-test


Your Answer

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

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