> high <- c(10,9,8,9,10,8)) > moderate <- c(8,10,6,7,8,8) > low <- c(4,6,6,4,2,2) > reaction <- c(10,9,8,9,10,8,8,10,6,7,8,8,4,6,6,4,2,2) > stresslvls <- c(rep("high",6), rep("moderate",6), rep("low",6)) > dat <- data.frame(reaction,stresslvls) > analysis <- lm(reaction ~ as.factor(stresslvls), data = dat) > anova(analysis) Analysis of Variance Table Response: stress Df Sum Sq Mean Sq F value Pr(>F) as.factor(stresslvls) 2 82.111 41.056 21.358 4.082e-05 *** Residuals 15 28.833 1.922 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
The ANOVA test essentially breaks a sample down into smaller groups and compares the variance between the means of each of those groups to determine how much variance can be attributed to chance.
Here, we have analyzed a grouping of the reaction times of participants that were subjected to various levels of stress. Above, we can see the return of the ANOVA test. We can see that the between-group mean sum of squares is 41.056. This shows that the difference between each of the individual sample means and the mean of all the samples. The F value is the ratio between the mean squares of the mean squares. The larger the F statistic is, the more you can rule out the difference between the means being due to chance. The fact that the P value is so small allows us to reject the null hypothesis and claim that the level of stress the participants are subjected does have an effect on their reaction times.