Skip to main content

Section 5.7 One-Way ANOVA

We have some idea, from both our visuals and descriptive statistics that the testing studying technique is better than the other two. However, while we do know that the means are different, we do not know if the difference between the means of the three techniques is statistically significant or not. We can not use t.tests because there are more than two groups. In order to uncover whether the difference between the studying technique means is statistically significant or not, we now conduct an ANOVA.
To do this, we can use the aov command which is very similar to t.test. The formula used is:
dependent_variable ~ independent_variable, data = your_data
To really bring it to the next level, we can also call the supernova command from the supernova package.
# running an anova
anova_model <- aov(score ~ method, data = memory)

summary(anova_model)
Df Sum Sq Mean Sq F value   Pr(>F)    
method       2   2657  1328.5   24.72 1.87e-08 ***
Residuals   57   3064    53.8                     
---
Signif. codes:  0 β€˜***’ 0.001 β€˜**’ 0.01 β€˜*’ 0.05 β€˜.’ 0.1 β€˜ ’ 1
We can also utilize the supernova() function, from the supernova package ([D.1.26]), for a cleaner output.
library(supernova)
supernova(anova_model)  # clearer ANOVA table
Analysis of Variance Table (Type III SS)
Model: score ~ method

                              SS df       MS      F   PRE     p
----- --------------- | -------- -- -------- ------ ----- -----
Model (error reduced) | 2656.938  2 1328.469 24.716 .4644 .0000
Error (from model)    | 3063.753 57   53.750                   
----- --------------- | -------- -- -------- ------ ----- -----
Total (empty model)   | 5720.691 59   96.961
Just as the aov command should look similar, the output of running the anova should look familiar. Reviewing the data we get:
  • Sum of Squares (SS): the total amount of variation explained by each source
    • Method SS - the amount of variation explained by the studying method - 2657
    • Residual SS- the amount of variation explained by everything other than method - 3063
    • The total is 5720, which means that about 46% of all variation in scores is due to studying method.
  • Df: degrees of freedom
    • There are 2 degrees of freedom (3-1), since there are 3 studying methods
  • Mean square: SS Γ· Df.
  • F value: how much larger the variation between groups is compared to the variation within groups
  • 24.72: there is more variation between the studying method groups than within each group.
  • pr(>F): the p-value
    • It is lower than 0.05, meaning there is a statistically significant difference in memory scores based on studying technique.
    • Hint: The number of * by the p-value indicates if it is significant or not. *** is statistically significant.
With all of that, we can now conclude that there is a statistically significant difference in memory scores due to studying technique. While this tells us that the difference is significant, it does not tell us what the difference between the techniques is. Through visualizations and descriptive statistics, we think testing is the best method, but it is important to make sure.