,Contents
1 Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Exercise 1.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Exercise 1.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Exercise 1.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Exercise 1.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Exercise 1.9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Exercise 1.11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Exercise 1.13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Exercise 1.15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Exercise 1.17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Exercise 1.19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Exercise 1.21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Exercise 1.23 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Exercise 1.25 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2 Completely Randomized Designs . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Exercise 2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Exercise 2.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Exercise 2.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Exercise 2.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Exercise 2.9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Exercise 2.11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Exercise 2.13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Exercise 2.15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Exercise 2.17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Exercise 2.19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Exercise 2.21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Exercise 2.23 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Exercise 2.25 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Exercise 2.27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Exercise 2.29 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
,2 Contents
Exercise 2.31 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3 Complete Block Designs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Exercise 3.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Exercise 3.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Exercise 3.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Exercise 3.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Exercise 3.9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Exercise 3.11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Exercise 3.13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Exercise 3.15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Exercise 3.17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Exercise 3.19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Exercise 3.21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Exercise 3.23 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Exercise 3.25 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Exercise 3.27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Exercise 3.29 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Exercise 3.31 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Exercise 3.33 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Exercise 3.35 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4 Interlude: Assessing the Effects of Blocking . . . . . . . . . . . . . . . . 37
Exercise 4.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Exercise 4.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Exercise 4.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Exercise 4.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Exercise 4.9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Exercise 4.11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Exercise 4.13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Exercise 4.15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Exercise 4.17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Exercise 4.19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5 Split Plot Designs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Exercise 5.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Exercise 5.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Exercise 5.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Exercise 5.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Exercise 5.9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Exercise 5.11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Exercise 5.13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Exercise 5.15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Exercise 5.17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Exercise 5.19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
, Contents 3
Exercise 5.21 ..................................... 57
Exercise 5.23 ..................................... 58
Exercise 5.25 ..................................... 58
Exercise 5.27 ..................................... 59
Exercise 5.29 ..................................... 60
Exercise 5.31 ..................................... 63
Exercise 5.33 ..................................... 64
Exercise 5.35 ..................................... 65
Exercise 5.37 ..................................... 66
Exercise 5.39 ..................................... 66
Exercise 5.41 ..................................... 66
6 Confounding in Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Exercise 6.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Exercise 6.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Exercise 6.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Exercise 6.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Exercise 6.9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Exercise 6.11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Exercise 6.13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Exercise 6.15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Exercise 6.17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Exercise 6.19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Exercise 6.21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Exercise 6.23 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Exercise 6.25 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Exercise 6.27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Exercise 6.29 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Exercise 6.31 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Exercise 6.33 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Exercise 6.35 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
,1
Basics
Essential
Exercise 1.1
Suppose that, in a greenhouse, each table has six pots, each with different
varieties. There are three plants for each pot. The anova is
Source df
Blocks 3
Varieties 5
T×V 15
Within 48
Total 71
The experimental unit is the pot, which is where the treatment is applied.
The plants in the plot are subsamples. Depending on what the experimenter
is willing to assume, the Within error may or may not be available to test the
T × B interaction. See Section 3.5.
Note also that we can remove a sum of squares for Pots (in Blocks) with
20 df, but this is then split into SS(Varieties) and SS(V × B).
Exercise 1.3
(1) The above example is a twoway CRD. We satisfy this exercise if we take
two plants per pot.
(2) We can modify the experiment in Exercise 1.1 to be a CRD in the following
way. Instead of having four tables, we can have one table. If it is a big
table and we cold put all 24 pots in it, then the anova would be
,6 1 Basics
Source df
Varieties 5
Pots (In Varieties) 18
Within(Plants in Pots) 48
Total 71
where here the test on Varieties is with the 18 df for Pots in Varieties. The
within is wasted.
Exercise 1.5
If all of the resources can be used we run all tanks and fish. Eight tanks per
diet and 6 fish per tank
Source df
Diets 2
Tanks (in Diets) 21
Fish (in Tanks) 120
If all tanks and fish cannot be run, to address (1) we need to have a
reasonable number of fish per tank, and can do with fewer tanks. In contrast,
(2) would want the number of tanks maximized, and the remaining funds to
be spent on fish per tank. Taking a stand, my feeling is that the number of
tanks should be maximized, but try to have at least 2-3 fish per tank.
Exercise 1.7
(a) Equation (1.4) follows directly from the two displays above it, and the fact
that the expectation of the difference is the difference of the expectations.
(b) (i) Since variance is unaffected by a constant,
h i2
¯ = Var Ȳ − Ȳ
Var Ȳi· − Ȳ ¯ − (τ − τ̄ ) = E (Ȳ − τ ) − (Ȳ ¯ − τ̄ ) ,
i· i i· i
and expanding the square gives the expression.
(ii) From the model, Var(Yij ) = σ 2 . The two expressions follow since these
are means of independent observations.
¯,
(iii) Using properties of covariance and the definition of Ȳ
t
¯)= 1
X
Cov(Ȳi· , Ȳ Cov(Ȳi· , Ȳi′ · )
t ′
i =1
P
where the fact that i τi = 0 allows use to change the mean. By
independence all the terms are zero expect when i = i′ , which gives
the variance.
(c) Equation (1.6) follows directly from the display above it, and unbiasedness
follows by dividing by the df.
, 1 Basics 7
Exercise 1.9
(a) The cross term is
E ([Y − E(Y |X)][E(Y |X) − E(Y )]) = E {E ([Y − E(Y |X)][E(Y |X) − E(Y )]) |X}
and evaluating the inner expectation gives
[E(Y |X) − E(Y |X)][E(Y |X) − E(Y )] = 0.
(b) Iterate the expectation in the first term to see that it is the variance of
E(Y |X). Iterating the expectation in the second term shows that it is the
expected value of Var(Y |X).
(c) Using the given probability model E(Y |X) = yi· and E(Y ) = y and we
can write
t r
1 XX
Var(Y ) = (yij − y)2
rt i=1 j=1
t
1X
Var[E(Y |X)] = (y − y)2
t i=1 i·
t r
1 XX
E[Var(Y |X)] = (yij − yi· )2 .
rt i=1 j=1
Exercise 1.11
(a) Yes
(b) No
(c) (0, 0, 0, 0, 1, −1)
Exercise 1.13
Contrasts.
(a) The R program is on the web.
(b) The original
P Helmert contrasts are not uncorrelated because they do not
satsify i ai bi /ri = 0, where the ri are in Example 1.15. The variation in
the example satisfies this condition. Note that there is a typo in the first
printing and the contrasts should be (the middle one is changed)
µ1 µ2 µ3 µ4
1 −8/19 −7/19 −4/19
0 1 −7/11 −4/11
0 0 1 −1
The treatment sum of squares in RehabTime2 can be partitioned with the
R code
,8 1 Basics
summary(aov(RehabTime~ConditionCode,data=aovdata))
#-------Treatment means - Be careful about the ordering
Rmean<-tapply(RehabTime, ConditionCode, mean)
nmean<-tapply(RehabTime, ConditionCode, length) #observations in each mean
#-------Contrast sums of squares\\
C1<-c(1,-8/19,-7/19,-4/19)\\
C2<-c(0,1,-7/11,-4/11)\\
C3<-c(0,0,1,-1)\\
SS1<-(Rmean%*%C1)\^ 2/(sum((C1\^2)/nmean))\\
SS2<-(Rmean%*%C2)\^2/(sum((C2\^2)/nmean))\\
SS3<-(Rmean%*%C3)\^2/(sum((C3\^2)/nmean))\\
print(c(SS1, SS2, SS3, SS1+SS2+SS3))
which produces the R output
Df Sum Sq Mean Sq F value Pr(>F)
ConditionCode 3 830.37 276.79 21.488 1.816e-06 ***
Residuals 20 257.63 12.88
---
467.1158 147.1388 216.1169 830.3714
(c) Multiplication verifies that they are uncorrelated. The three sums of
squares are
577.47929 16.05982 236.83232,
which can be obtained from the same R code as above.
In no situation would I advise and experimenter to use the uncorrelated
contrasts. They are an artifact of the unequal number of observations, and
provide no meaningful inference. The original Helmert contrasts should be
used.
Exercise 1.15
The data for the experiment described in Exercise 1.16 can be found in dataset
FishTissueMass. Using these data, complete the anova table that was started
in the exercise. Note that the data are unbalanced, so orthogonal contrasts
are not uncorrelated.
(a) Here is the R code for the anova and the contrasts.
aovdata <- data.frame(Y,Tissue,hCG)
#----------This gives the anova table----------------
summary(aov(Y~Tissue*hCG,data=aovdata))
, 1 Basics 9
#----------Main Effect Polynomial Contrasts---------------------
Tmean<-tapply(Y,Tissue,mean)
n<-tapply(Y,Tissue,length)
PC<-contr.poly(4,score=1:4) #polynomial contrasts
SS1=(sum(Tmean*PC[,1]))^2/sum(PC[,1]^2/n)
SS2=(sum(Tmean*PC[,2]))^2/sum(PC[,2]^2/n)
SS3=(sum(Tmean*PC[,3]))^2/sum(PC[,3]^2/n)
print(c(SS1, SS2, SS3, SS1+SS2+SS3))
#-----------Cell means and observation numbers_------
aov1<-subset(aovdata,hCG=="N")
mean1<-tapply(aov1[,1],aov1[,2],mean)
n1<-tapply(aov1[,1],aov1[,2],length)
aov2<-subset(aovdata,hCG=="Y")
mean2<-tapply(aov2[,1],aov2[,2],mean)
n2<-tapply(aov2[,1],aov2[,2],length)
#-----------Interaction Polynomial Contrasts-----------------------
SS1=(sum(mean1*PC[,1]-mean2*PC[,1]))^2/(sum(PC[,1]^2/n1)+sum(PC[,1]^2/n2))
SS2=(sum(mean1*PC[,2]-mean2*PC[,2]))^2/(sum(PC[,2]^2/n1)+sum(PC[,2]^2/n2))
SS3=(sum(mean1*PC[,3]-mean2*PC[,3]))^2/(sum(PC[,3]^2/n1)+sum(PC[,3]^2/n2))
print(c(SS1, SS2, SS3, SS1+SS2+SS3))
Which gives the output
Df Sum Sq Mean Sq F value Pr(>F)
Tissue 3 1.67479 0.55826 0.7910 0.5589
hCG 1 0.43426 0.43426 0.6153 0.4767
Tissue:hCG 3 1.49048 0.49683 0.7039 0.5975
Residuals 4 2.82319 0.70580
0.12627 1.54825 0.00027 1.67479
0.33326 0.41810 0.73912 1.49048
The main effect contrasts have equal cell sizes, so there is no problem with
uncorrelated.
(b) It turns out (to my surprise) that with this pattern of unequal n all of the
polynomial contrasts remain uncorrelated, so we don’t need another set.
(c) Again, we want to use the orthogonal contrasts, even if the sum of squares
is not partitioned.
Exercise 1.17
(1) The first randomization is throughout. So for the first experiment, we
choose a variety and a treatment at random, and put them on a plot.
, 10 1 Basics
For the other experiment, we choose a weight class and an age class at
random, and take the measure.
(2) Here the Fertilizer can be applied to a plot, and three levels of Variety are
randomized. Or we choose and age class at random, and measure three
people of different weights.
(3) Fertilizer is applied in one direction, and Varieties are planted in the other.
This is problematic for the other experiment, as the treatments are not
“applied”.
Exercise 1.19
(a) This R statement
summary(aov(Y~Block+Shipping+Storage+Shipping:Storage,data=aovdata))
will produce the “wrong” anova table
Df Sum Sq Mean Sq F value Pr(>F)
Block 2 2483.3 1241.7 9.8014 0.0001935 ***
Shipping 2 156.3 78.2 0.6170 0.5427454
Storage 1 703.2 703.2 5.5509 0.0215459 *
Shipping:Storage 2 3.8 1.9 0.0151 0.9850328
Residuals 64 8107.6 126.7
(b) This R statement
summary(aov(Y~Block*Shipping*Storage),data=aovdata))
will produce an anova table with all of the block × treatment interactions.
The tests have to be done by hand.
(c) This R statement
summary(aov(Y~Block+Shipping+Storage+Shipping:Storage
+Error(Block/Block:Shipping:Storage),data=aovdata))
will produce an anova where the treatment tests are done against the
pooled treatment × block interaction. The output is