Skip to main content

Module 11: ANOVA - Analysis of Variance

ANOVA can be used to compare the means of several populations with continuous populations simultaneously. The population variance of the dependent variable must be equal in all groups.

Recall that 

image-1661787218645.png

Which is the difference in two means over the standard error. When comparing multiple independent samples it is easier to use a pooled variance, but to do so the variances must be equal.

Equality of Variances

The equation for pool variance:

image-1661786979127.png

Assumption for pooled variance is that variances in the two groups are equal. We can test this with H0 = σ12 and use the F distribution which is indexed by the denominator df and the numerator df; choose the larger estimated variance to be numerator and the smaller estimated variance to be the denominator.

Test statistic:

image-1661786021211.png

If F is greater or smaller than critical values for a given significance level the null hypothesis is rejected and we can conclude there is evidence the two population variances are not equal.

image-1661786379416.png

The F distribution is not symmetric, which makes it hard to look up critical values. It can be done in R: pf(F, df1, df2, lower=F)

The F test is not always appropriate as it is sensitive to departures from normality. Examine variability in the two groups by comparing sample variances using boxplots to help decide which standard error is appropriate. In the case where variances are unequal we use the same procedure but SE is estimated as:

image-1661786664024.png

Using the n-1 degrees of freedom from whichever sample is smaller as an approximate (SAS or R would figure out the exact value).

ANOVA

Terminology:

  • Factor - category/grouping variable
  • Level - individual group of the factor
  • Balanced design - same number of individuals in each level

The general data configuration is we have k population groups each with nk observations, which can be the same or different.

Assumptions:

  • Observations are independent
  • Data are random samples from k independent populations
  • Within each population the dependent variable is normally distributed
  • The population variance of the dependent variable is equal in all groups.

H0: The k populations means are equal

Ha : The k populations means are not all equal or at least one is not equal

Recall that variance as a function of Y is:

image-1661787816927.png

The numerator is the "Total variability" or the "Total sum of squares" (SST)

In ANOVA we split the SST into two components:

  1. Variability due to differences between the groups (SS Between Groups)
  2. Variability due to differences between individual y values within the groups (SS Within Group)

image-1661788124183.png

Which can also be expressed as:

image-1661788059695.png

SS Total = SS Within Groups + SS Between Groups

image-1661788257712.png

R2 is the proportion of variability explained by the difference between groups:

R2 = SS Between / SS Total