56
$\begingroup$

I'm sure I've got this completely wrapped round my head, but I just can't figure it out.

The t-test compares two normal distributions using the Z distribution. That's why there's an assumption of normality in the DATA.

ANOVA is equivalent to linear regression with dummy variables, and uses sums of squares, just like OLS. That's why there's an assumption of normality of RESIDUALS.

It's taken me several years, but I think I've finally grasped those basic facts. So why is it that the t-test is equivalent to ANOVA with two groups? How can they be equivalent if they don't even assume the same things about the data?

$\endgroup$
2
  • 21
    $\begingroup$ One point: t-tests use the t distribution not the Z distribution $\endgroup$ Commented Aug 13, 2010 at 10:12
  • 1
    $\begingroup$ Even though question is not correct, it is very useful. Also, I think mentioning "two tailed t-test" somewhere will make the questions/answers more complete. $\endgroup$ Commented Jul 29, 2016 at 22:10

4 Answers 4

38
$\begingroup$

The t-test with two groups assumes that each group is normally distributed with the same variance (although the means may differ under the alternative hypothesis). That is equivalent to a regression with a dummy variable as the regression allows the mean of each group to differ but not the variance. Hence the residuals (equal to the data with the group means subtracted) have the same distribution --- that is, they are normally distributed with zero mean.

A t-test with unequal variances is not equivalent to a one-way ANOVA.

$\endgroup$
3
  • 4
    $\begingroup$ I can look up a citation, but this is easy enough to to test empirically. F from an ANOVA with two groups is exactly equaly to t^2 and the p-values will be exactly the same. The only reason it wouldn't be equivalent in the case of unequal variances is if you apply a correction. Otherwise, they are the same. $\endgroup$
    – Brett
    Commented Aug 13, 2010 at 14:54
  • 4
    $\begingroup$ F-test is the generalization of t test. t-test is for 2 treatment comparison and the F test is for multiple treatments. The derivation is in Casella's Statistical Design, Chapter 3 and 4. However, as Prof. Hyndman points out, with unequal variances, it is not a t-test anymore. It is the Fisher Behren's problem. We generally don't use the Fisher's solution, instead use Welch's Test or a Bayesian approach. $\endgroup$
    – suncoolsu
    Commented Feb 4, 2011 at 1:35
  • $\begingroup$ A two-sample t-test with unequal variances is indeed equal to a one-way ANOVA with two groups. Perhaps what you meant was that a t-test using a correction for unequal variances (i.e. Welch) is not the same as a one-way ANOVA that is not corrected (though why would they be)? $\endgroup$
    – Brett
    Commented Jun 1, 2017 at 18:24
28
$\begingroup$

The t-test simply a special case of the F-test where only two groups are being compared. The result of either will be exactly the same in terms of the p-value and there is a simple relationship between the F and t statistics as well. F = t^2. The two tests are algebraically equivalent and their assumptions are the same.

In fact, these equivalences extend to the whole class of ANOVAs, t-tests, and linear regression models. The t-test is a special case of ANOVA. ANOVA is a special case of regression. All of these procedures are subsumed under the General Linear Model and share the same assumptions.

  1. Independence of observations.
  2. Normality of residuals = normality in each group in the special case.
  3. Equal of variances of residuals = equal variances across groups in the special case.

You might think of it as normality in the data, but you are checking for normality in each group--which is actually the same as checking for normality in the residuals when the only predictor in the model is an indicator of group. Likewise with equal variances.

Just as an aside, R does not have seperate routines for ANOVA. The anova functions in R are just wrappers to the lm() function--the same thing that is used to fit linear regression models--packaged a little differently to provide what is typically found in an ANOVA summary rather than a regression summary.

$\endgroup$
6
  • $\begingroup$ Would be interested to know how to fit repeated measures ANOVA models using lm. $\endgroup$
    – Andi F
    Commented Aug 13, 2010 at 15:51
  • 2
    $\begingroup$ The issues of coding categorical variables, the equivalence of regression and ANOVA models, and regression coding for repeated measures are described in this article. dionysus.psych.wisc.edu/Lit/Topics/Statistics/Contrasts/… Here's the citation... Wendorf, C. A. (2004). Primer on multiple regression coding: Common forms and the additional case of repeated contrasts. Understanding Statistics 3, 47-57. $\endgroup$
    – Brett
    Commented Aug 13, 2010 at 16:11
  • 4
    $\begingroup$ @AndyF Not lm(), unless you move to mixed-models with the nlme or lme4 package, but there's a handy way to handle repeated-measurements through appropriate specification of the Error term in aov(), see more details on Baron & Li tutorial, §6.9, j.mp/c5ME4u $\endgroup$
    – chl
    Commented Sep 16, 2010 at 17:25
  • $\begingroup$ @AndyF aov() is built on top of the lm() function but include additional argument, called Special terms, like Error. $\endgroup$
    – chl
    Commented Sep 19, 2010 at 17:44
  • $\begingroup$ aov() is simply a wrapper to lm(). It does some contrast coding behind the scenes and packages the result in the ANOVA style. All of it is modeled by lm(). In the article I referenced above, it tells you how to set up coding to do repeated contrasts in regression models, including lm(). $\endgroup$
    – Brett
    Commented Sep 19, 2010 at 18:51
19
$\begingroup$

I totally agree with Rob's answer, but let me put it another way (using wikipedia):

Assumptions ANOVA:

  • Independence of cases – this is an assumption of the model that simplifies the statistical analysis.
  • Normality – the distributions of the residuals are normal.
  • Equality (or "homogeneity") of variances, called homoscedasticity

Assumptions t-test:

  • Each of the two populations being compared should follow a normal distribution ...
  • ... the two populations being compared should have the same variance ...
  • The data used to carry out the test should be sampled independently from the two populations being compared.

Hence, I would refute the question, as they obviously have the same assumptions (although in a different order :-) ).

$\endgroup$
3
  • $\begingroup$ See comment to Rob. $\endgroup$
    – Alexis
    Commented May 4, 2014 at 14:17
  • $\begingroup$ @Alexis I am not sure I understand your downvote. Care to elaborate. $\endgroup$
    – Henrik
    Commented May 6, 2014 at 13:20
  • $\begingroup$ The second t test assumption is not true. Student's original work through assumed this, but "unequal variances" is a common enough assumption in later treatment the test. $\endgroup$
    – Alexis
    Commented May 6, 2014 at 13:24
8
$\begingroup$

One obvious point that everyone's overlooked: With ANOVA you're testing the null that the mean is identical regardless of the values of your explanatory variables. With a T-Test you can also test the one-sided case, that the mean is specifically greater given one value of your explanatory variable than given the other.

$\endgroup$
2
  • 1
    $\begingroup$ Unless I'm mistaken, this is NOT a difference. If you do an ANOVA on two groups, then you can do a "one-sided test" just as you can in a t-test. I put "one-sided test" in quotation marks because there is actually no difference in the "test" between a "one-sided test" and a "two-sided test". The only difference is how you interpret the statistical significance of the p-values. So the one-sided vs two-sided "tests" are the exactly the same "test". Only the way to correctly interpret the results is different. $\endgroup$
    – Tripartio
    Commented Mar 27, 2018 at 9:16
  • 2
    $\begingroup$ @Tripartio the one-sided ANOVA test is different from the one-sided t-test. The one-sided t-test is more specifically to test the $H_0:\theta = 0$ against the alternatives $H_a:\theta > 0$ or $H_a:\theta < 0$ instead of the alternative $H_a: \theta \neq 0$. The one-sided F-test (null hypothesis is equal variance, alternative hypothesis is between groups variance is larger) is equal to the two-sided t-test. The one-sided t-test has no F-test/ANOVA equivalence. $\endgroup$ Commented Oct 16, 2020 at 8:11

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.