11
$\begingroup$

I have a distribution of salaries and I want to compare the difference in means for males and females. I know there's the student T-test for comparing two means but after suggesting ANOVA I received some criticism saying that ANOVA is for comparing more than two means.

What (if anything) is wrong in using it for comparing only 2 means?

$\endgroup$
6
  • 9
    $\begingroup$ Who says it's wrong? $\endgroup$ – gung - Reinstate Monica Sep 25 '16 at 22:50
  • 1
    $\begingroup$ Why don't you rephrase the question suppressing any assumptions? Something along the lines of "Is ANOVA equivalent to a t-test when comparing two groups?" Just an idea... I'll take no responsibility for how welcome the question is either way :-) $\endgroup$ – Antoni Parellada Sep 26 '16 at 0:21
  • 4
    $\begingroup$ Alternatively modify your question to show someone saying that it is wrong ... so we can explain that they're mistaken. The difficulty here is the premise of the question (that it is wrong) is mistaken. $\endgroup$ – Glen_b Sep 26 '16 at 0:30
  • 1
    $\begingroup$ Although the premise is mistaken, this question does not seem to be off topic or so unclear it cannot be answered (indeed, it has been answered). I think this can stay open. $\endgroup$ – gung - Reinstate Monica Sep 26 '16 at 0:50
  • 1
    $\begingroup$ Agreed, @ gung . I think the question reflects a lack of knowledge about the topic. If it was worded differently (or "better"), then the question would probably not have been asked because then they would have already known the answer. $\endgroup$ – D_Williams Sep 26 '16 at 5:06
21
$\begingroup$

It is not wrong and will be equivalent to a t test that assumes equal variances. Moreover, with two groups, sqrt(f-statistic) equals the (aboslute value of the) t-statistic. I am somewhat confident that a t-test with unequal variances is not equivalent. Since you can get appropriate estimates when the variances are unequal (variances are generally always unequal to some decimal place), it probably makes sense to use the t-test as it is more flexible than an ANOVA (assuming you only have two groups).

Update:

Here is code to show that the t-statistic^2 for the equal variance t-test, but not the unequal t-test, is the same as the f-statistic.

dat_mtcars <- mtcars

# unequal variance model
 t_unequal <- t.test(mpg ~ factor(vs), data = dat_mtcars)
 t_stat_unequal <-  t_unequal$statistic

# assume equal variance
 t_equal <- t.test(mpg ~ factor(vs), var.equal = TRUE, data = dat_mtcars)
 t_stat_equal <- t_equal$statistic

# anova
 a_equal <- aov(mpg ~ factor(vs), data = dat_mtcars)
 f_stat <- anova(a_equal)
 f_stat$`F value`[1]

# compare by dividing (1 = equivalence)
 (t_stat_unequal^2) / f_stat$`F value`[1] 
 (t_stat_equal^2) / f_stat$`F value`[1] # (t-stat with equal var^2) = F
$\endgroup$
3
  • 3
    $\begingroup$ +1, note that it is possible to adjust a one-way ANOVA / F-test for unequal variances (cf. Alternatives to one-way ANOVA for heteroskedastic data). $\endgroup$ – gung - Reinstate Monica Sep 26 '16 at 2:46
  • $\begingroup$ @gung OK. I was not sure about this, as I have not used ANOVA in sometime (been doing the Bayesian thing). $\endgroup$ – D_Williams Sep 26 '16 at 3:49
  • $\begingroup$ There is one other advantage to performing $t$ tests: If you have a directional hypothesis you can perform a one-tailed $t$ test; ANOVA on the other hand always test non-directional hypotheses. $\endgroup$ – crsh Sep 27 '16 at 12:19
4
$\begingroup$

They are equivalent. An ANOVA with only two groups is equivalent to a t-test. The difference is when you have several groups then the type I error will increase for the t-tests as you are not able to test the hypothesis jointly. ANOVA does not suffer from this problem as you jointly test them through an F-test.

$\endgroup$
3
  • 1
    $\begingroup$ I don't think it loses power, I think it has more to do with the type I errors. In general, the more tests you have, the higher power you should get. $\endgroup$ – SmallChess Sep 26 '16 at 5:08
  • $\begingroup$ I believe (as @StudentT says) it's a matter of type I errors, In a course I'm taking they're making us use the "Bonferroni Correction" exactly for this. en.wikipedia.org/wiki/Bonferroni_correction $\endgroup$ – Pablo Fernandez Sep 26 '16 at 15:10
  • $\begingroup$ Yes, youre are correct. It should not be power (type II) but type I errors. I believe the reasoning is correct but for some reason I wrote power and not type 1 error. I will edit to make sure I dont fool anyone. $\endgroup$ – robinsa Sep 27 '16 at 12:03

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.