47
$\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$
  • 15
    $\begingroup$ One point: t-tests use the t distribution not the Z distribution $\endgroup$ – Jeromy Anglim Aug 13 '10 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$ – Gaurav Singhal Jul 29 '16 at 22:10
29
$\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
    $\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 Aug 13 '10 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 Feb 4 '11 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 Jun 1 '17 at 18:24
20
$\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$
  • $\begingroup$ Would be interested to know how to fit repeated measures ANOVA models using lm. $\endgroup$ – AndyF Aug 13 '10 at 15:51
  • 1
    $\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 Aug 13 '10 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 Sep 16 '10 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 Sep 19 '10 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 Sep 19 '10 at 18:51
17
$\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$
  • $\begingroup$ See comment to Rob. $\endgroup$ – Alexis May 4 '14 at 14:17
  • $\begingroup$ @Alexis I am not sure I understand your downvote. Care to elaborate. $\endgroup$ – Henrik May 6 '14 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 May 6 '14 at 13:24
5
$\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$
  • 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 Mar 27 '18 at 9:16
-3
$\begingroup$

I will prefer to use t-test for comparing two groups and will use ANOVA for more than 2 groups, due to reasons. Important reason being the assumption of equal variances.

$\endgroup$
  • 5
    $\begingroup$ Welcome to the site, @syed. Would you mind expanding on your answer? For example, what "reasons" are you referring to? Note that both the t-test & ANOVA assume equal variances. $\endgroup$ – gung - Reinstate Monica Jan 8 '13 at 15:49

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.