Mice experiment: Short version of data set to illustrate ANOVA
See this link for a description of the mice data.
To illustrate the method of one-way ANOVA, we use a subset of the mice.df data called mice.short.df. The data are given below. Put this into a data frame called miceshort.df by cutting and pasting with this R code:
miceshort.df <- read.table(file='clipboard',header=T)
The vectors data, grand, effects, and resid are maximum likelihood estimates of model parameters discussed in class and in the textbook. Look at the results of the following R commands. They illustrate sums of squares calculations we make in the one-way ANOVA discussion.
Here, now, is R code for do an analysis:
# First description of the data via plot and summary statistics: boxplot(Lifetime ~ Treatment) nn <- tapply(Lifetime, Treatment, length) mm <- tapply(Lifetime, Treatment, mean) ss <- tapply(Lifetime, Treatment, sd) round(cbind(nn,mm,ss),1) #Next, calculate an ANOVA table (noting agreement with the # partitioning of sums of squares: attach(mice.short.df) mice.aov <- aov(Lifetime ~ Treatment)) summary(mice.aov)
Finally we do some
Follow-up analysis:
pairwise.t.test(Lifetime, Treatment, p.adj="bonferroni")
Mice data set: short version
Here is the data:
Treatment Lifetime grand Effects Resid
1 NP 35.5 46.00667 -11.126667 0.62
2 NP 35.4 46.00667 -11.126667 0.52
3 NP 34.9 46.00667 -11.126667 0.02
4 NP 34.8 46.00667 -11.126667 -0.08
5 NP 33.8 46.00667 -11.126667 -1.08
6 N/N85 42.3 46.00667 -6.226667 2.52
7 N/N85 40.1 46.00667 -6.226667 0.32
8 N/N85 39.5 46.00667 -6.226667 -0.28
9 N/N85 38.6 46.00667 -6.226667 -1.18
10 N/N85 38.4 46.00667 -6.226667 -1.38
11 N/R50 49.7 46.00667 2.773333 0.92
12 N/R50 49.3 46.00667 2.773333 0.52
13 N/R50 48.6 46.00667 2.773333 -0.18
14 N/R50 48.3 46.00667 2.773333 -0.48
15 N/R50 48.0 46.00667 2.773333 -0.78
16 R/R50 49.1 46.00667 2.433333 0.66
17 R/R50 48.7 46.00667 2.433333 0.26
18 R/R50 48.3 46.00667 2.433333 -0.14
19 R/R50 48.1 46.00667 2.433333 -0.34
20 R/R50 48.0 46.00667 2.433333 -0.44
21 N/R50_lopro 50.7 46.00667 4.433333 0.26
22 N/R50_lopro 50.6 46.00667 4.433333 0.16
23 N/R50_lopro 50.5 46.00667 4.433333 0.06
24 N/R50_lopro 50.3 46.00667 4.433333 -0.14
25 N/R50_lopro 50.1 46.00667 4.433333 -0.34
26 N/R40 54.6 46.00667 7.713333 0.88
27 N/R40 54.0 46.00667 7.713333 0.28
28 N/R40 53.8 46.00667 7.713333 0.08
29 N/R40 53.3 46.00667 7.713333 -0.42
30 N/R40 52.9 46.00667 7.713333 -0.82
sum(Effects*Resid)
[1] 3.596845e-13
sum(Resid^2)
16.416
sum(Effects^2)
1276.683
sum((Lifetime - grand)^2)
1293.099