In this example I am using some data from an evaluation of my research classes, where I did a pre-test and a post-test of my classes. What I want to do here is to compare the three classes, Tuesday, Saturday, online. Tuesday was a regular face-to-face class, Saturday was a hybrid class, where students watched pre-recorded lecture and came to class to do discussion and online had the same pre-recorded lectures as Saturday, but did their discussion via synchronous video enabled chats. the NULL hypothesis would be that the means of the percent improvement PERCENTIMP variable would be equal between the three groups.
SW <-read.delim("/Volumes/Mirror Mirror /Google Drive/Research_UMKC/SE4SW.FE/T_Tests/prepost.txt")
names(SW)
## [1] "Class" "PRE" "POST" "IMPROVE" "PERCENTIMP"
## [6] "PrePF" "PostPF" "PrePF.1" "PostPF.1"
first do the anova
we do this by creating a R object, which we are calling āmodelā
model <- aov(PERCENTIMP ~ Class, data = SW)
here is the play by play
the aov is our R function, it tells R we want to do an Analysis of Variance,
inside the ( ) we have PERCENTIMP ~ Class which tells R we want to test the differences in PERCENTIMP by categories of Class finally where we see data = SW that is us telling R where to find PERCENTIMP and Class
we view our ANOVA by summarizing the object i.e., model we just created.
summary(model)
## Df Sum Sq Mean Sq F value Pr(>F)
## Class 2 1439 719.7 1.168 0.322
## Residuals 39 24036 616.3
using numSummary gives us an easy way to get summary stats of our groups when doing ANOVA.
require(RcmdrMisc)
numSummary(SW$PERCENTIMP, groups = SW$Class, statistics = c('mean','sd'))
## mean sd data:n
## online 9.74375 30.22536 16
## Saturday 11.86600 24.88175 10
## Tuesday 22.49812 17.81388 16
here we wee that our analysis of variance test gives us a F of 2.5 and our probability is P = 0.095. Which is under .1, ## where the differences lie
Then we take a look at the between groups differences. Using the Tukey Honest Significant Differences test
require(graphics)
TukeyHSD(model,'Class', ordered = FALSE)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = PERCENTIMP ~ Class, data = SW)
##
## $Class
## diff lwr upr p adj
## Saturday-online 2.12225 -22.258847 26.50335 0.9755278
## Tuesday-online 12.75437 -8.629261 34.13801 0.3243128
## Tuesday-Saturday 10.63213 -13.748972 35.01322 0.5427289
IT is often helpful for some folks to visualize their Tukey scores using the plot see below. You could also make an object and name it like we did above with the aov. We āreadā the plot by looking at the 0 line in the middle and if they all overlap,
plot(TukeyHSD(model,'Class', ordered = FALSE) )
The ANOVA Test in R is pretty simple to do, either using R Commander or via scripting.
## we were only interested in Class and PERCENTIMP variables above. But what if we wanted to know if there was a pass and fail difference in the two groups.
But wait that would be two-way ANOVA
Follow the link to the two-way anova hereā¦.
Click on Dorothy to go back to the home page.
there's no place like the home page, there's no place like home