Analysis of variance

An ANOVA test is used to compare means between more than two groups. One-way ANOVA uses one independent variable, and two-way ANOVA uses two independent variables.(two factors that are being tested simultaneously)

Two main aim of ANOVA tests

  • To explain the relative contribution of the different factors or combination of different factors to response variable /dependent variable
  • To test the null hypothesis/ means of the population groups are equal

An ANOVA test is important to identify which factors (independent variables) have a significant effect on the response variables, and how much variability in the response variables is attributed to the response variables. This variability is measured as the sum of squares.

Assumption of ANOVA

  • Samples are independent
  • Response variable should be measured at continuous level
  • Response variables should be normally distributed
  • Each population have same variance

EXAMPLE 1

weight (levels) R1 R2 R3 R4 R5 Mean
45Kg12151179
55Kg111311810
65Kg111321911
Table 2: Data table
  • n = Total No. of data
  • T = Row
  • c = No. of replicate.

SST = ∑ (X2) – (∑X)2/n

SSL = (∑ (Ti2))/c – (∑X)2/n

SSE = ∑ (X2) – ∑(Ti)2/c

ANOVA table

Source of variation Degree of freedom (df) Sum of square (SS) Mean square (MS) F
between/treatmentsdfLSSLSSL/dfLMSL/MSE
within/errordfT – dfLSST – SSL(SST – SSL)/(dfT – dfL)
TotaldfTSST
Table 2 : ANOVA table

dfL (treatments)= t -1

dfT (Total) = n-1

dfE (error) = n – t

Critical value is find by F – distribution tables,

If calculated value is greater than the critical value (FCAL > F CRI ) null hypothesis rejected & accept the alternative hypothesis

Multiple comparison Tests

If ANOVA found there is a significant effect from one or factors (independent variables) to the response variable, repeated T – tests are performed (post hoc comparisons) to find which means are significantly different from one another, such as Tukey’s HSD test, Tukey’s Kramer test and Fisher’s LSD test

  • Tukey’s HSD test can be performed with the equal group sizes
  • Tukey’s Kramer test and Fisher’s LSD test can be performed with both equal and unequal groups sizes.
  • if the mean difference is greater than the critical value, mean of the two populations are significantly different.

ANOVA test in R

# ONE WAY ANOVA
#Creates a boxplot
boxplot(Dependent_Variable ~ Factor, main, xlab, ylab, col)

#Test for normality
shapiro.test(Dependent_variable)

#ONE WAY ANOVA test
one_way_anova <- aov(Dependent_Variable ~ Factor)
summary (one_way_anova)

#post-hos test
TukeyHSD(one_way_anova, conf.level=0.95)

#TWO WAY ANOVA 
#Creates a boxplot
boxplot(Dependent_Variable ~ Factor1:Factor2:Factor3, main, xlab, ylab, col)

#Test for normality
shapiro.test(Dependent_variable)

#TWO WAY ANOVA test
two_way_anova <- aov(Dependent_Variable ~ Factor1+Factor2+Factor3)
summary (two_way_anova)

#post-hos test
TukeyHSD(two_way_anova, conf.level=0.95)

Leave a Reply

Your email address will not be published.