Lectures Stat 530
Lectures Stat 530
1
Derivation of the test statistic.
Definition. A fixed effects model is the model in which levels of the fac-
tor are chosen by the experimenter. In our example, the three looms are the
only looms at the factory, so it is a fixed effects model.
Definition. A random effects model is the model in which the a treatments
are a random sample from a larger population of treatments. For example, a
textile factory has one hundred looms. A quality control engineer randomly
chooses three looms, and obtains four random samples of fabrics for every
loom. This is an example of a random effects model.
∑
a ∑
n
y..
y.. = yij , ȳ.. = , N = na.
i=1 j=1
N
∑
a ∑
a ∑
n ∑
a ∑
n
=n (ȳi. − ȳ.. ) +
2
(yij − ȳi. ) + 2
2
(ȳi. − ȳ.. )(yij − ȳi. ).
i=1 i=1 j=1 i=1 j=1
2
SStr SSE
The quantities M Str = a−1
and M SE = N −a
are called mean squares. It can
be shown that
∑a
n τi2
E(M Str ) = σ +2 i=1
and E(M SE ) = σ 2 .
a−1
Under H0 , both M SE and M Str are estimates of σ 2 . Moreover, it can be
shown (Cochran’s Theorem, page 69) that, under H0 , SSE /σ 2 and SStr /σ 2
are independent chi-square random variables with N − a and a − 1 degrees
of freedom. Therefore, if the null hypothesis is true, the ratio
Computational Formulas.
∑
a ∑
n
y..2
SST = yij2 − ,
i=1 j=1
N
∑
a
y2 y..2
SStr = i.
− ,
i=1
n N
SSE = SST − SStr .
The one-way ANOVA table looks like this
3
Example. In the example with looms, test whether the looms produce fab-
ric of different strength. Use α = 0.05.
Solution: We want to test H0 : τ1 = τ2 = τ3 = 0 against H1 : τi ̸= 0 for some
i = 1, 2, 3.
Source SS df MS F
Looms 52.67 2 26.34 6.41
Error 37 9 4.11
Total 89.67 11
F0.05, 2, 9 = 4.26 ⇒ reject H0 and conclude that the fabrics differ in strength.
In the example with looms, µ̂ = 1106/12 = 92.17, µ̂1 = 360/4 = 90, µ̂2 =
366/4 = 91.5, µ̂3 = 380/4 = 95, τ̂1 = 90−92.17 = −2.17, τ̂2 = 91.5−92.17 =
−0.67, τ̂3 = 95 − 92.17 = 2.83.
Confidence Intervals.
4
√
µi − µj is ȳi. − ȳj. ± tα/2, N −a 2M SE /n.
In our example, the 95% confidence intervals for the treatment means and
the difference in treatment means are computed as follows:
ȳ1. = 90, ȳ2. = 91.5, ȳ3. = 95, M SE = 4.11, N = 12, a = 3, t.025, 9 = 2.262,
n = 4, 87.71 ≤ µ1 ≤ 92.29, 89.21 ≤ µ2 ≤ 93.79, 92.71 ≤ µ3 ≤ 97.29,
−1.74 ≤ µ2 − µ1 ≤ 4.74, 1.76 ≤ µ3 − µ1 ≤ 8.24, 0.26 ≤ µ3 − µ2 ≤ 6.74.
Notice that the confidence interval for the difference between µ2 and µ1 in-
cludes zero, but the other two intervals don’t. It means that there is no
statistical difference between looms one and two, but there is difference be-
tween looms one and three, and two and three.
(b) Construct the 99% confidence intervals for the treatment means and
for the differences in treatment means.
Solution: t0.005, 12 = 3.055, 138.49 ≤ µ1 ≤ 151.51, 138.74 ≤ µ2 ≤ 151.76, 126.24 ≤
µ3 ≤ 139.26, 122.74 ≤ µ4 ≤ 135.76, −8.98 ≤ µ2 − µ1 ≤ 9.48, 3.02 ≤
µ1 − µ3 ≤ 21.48, −5.73 ≤ µ3 − µ4 ≤ 12.73.
We study three tests: Tukey’s test, the Fisher Least Significant Difference
5
(LSD) method, and Duncan’s Multiple Range test.
The test declares two means significantly different if the absolute value of
the difference of the√ respective sample treatment means exceeds
Tα = qα (a, N − a) M SE /n where the critical value qα (a, N − a) comes from
table VIII on pages 656-657.
Example. In the example with looms, we would like to test simultaneously
three pairs of hypotheses H0 : µ1 = µ2 against H1 : µ1 ̸= µ2 , H0 : µ2 = µ3
against H1 : µ2 ̸= µ3 , and H0 : µ1 = µ3 against H1 : µ1 ̸= µ3 .
The three sample treatment means are ȳ1. = 90, ȳ2. = 91.5, ȳ3. = 95. The
differences in the means are
ȳ1. − ȳ2. = −1.5
ȳ2. − ȳ3. = −3.5
ȳ1. − ȳ3. = −5.
The absolute values √ of these quantities
√ should be compared to
T0.05 = q0.05 (3, 9) M SE /n = 3.95 4.11/4 = 4.00. The conclusion is that
there is a significant difference between µ1 and µ3 but the differences between
µ1 and µ2 , and µ2 and µ3 are insignificant. This can be presented graphically
as
6
√ √
Example. R2 = √ r0.05 (2, 9) M S
√ E /n = 3.2 4.11/4 = 3.24,
R3 = r0.05 (3, 9) M SE /n = 3.34 4.11/4 = 3.39.
ȳ3. − ȳ1. = 5 > 3.39(R3 )
ȳ3. − ȳ2. = 3.5 > 3.24(R2 )
ȳ2. − ȳ1. = 1.5 < 3.24(R2 )
The conclusion is that µ1 and µ3 , as well as µ2 and µ3 differ significantly, but
µ1 and µ2 do not.
3.5.4. Contrasts.
The critical value t0.025, 9 = 2.262. We accept the null and conclude that the
mean strength for loom 2 equals the average of the means for loom 1 and 3.
7
3.5.5. Orthogonal Contrasts.
Definition.
∑a Two contrasts with coefficients {ci } and {di } are orthogonal
if i=1 ci di = 0.
Example. Γ1 = µ1 − 2µ2 + µ3 and Γ2 = µ1 − µ3 are orthogonal since
(1)(1) + (−2)(0) + (1)(−1) = 0.
C1 = y1. − 2y2. + y3. = 360 − (2)(366) + 380 = 8, and C2 = y1. − y3. = −20
are
(8)2 (−20)2
SSC1 = = 2.67, and SSC2 = = 50.
(4)(6) (4)(2)
Notice that SStr = 52.67 = SSC1 + SSC2 .
The ANOVA table is
Source SS df MS F
Looms 52.67 2 26.34 6.41
C1 : 2µ2 = µ1 + µ3 (2.67) 1 2.67 0.65
C2 : µ1 = µ3 (50) 1 50 12.17
Error 37 9 4.11
Total 89.67 11
Since F0.05, 1, 9 = 5.12, we reject H0 : µ1 = µ3 and conclude that the means
for loom and one and loom three differ significantly, whereas we accept
H0 : 2µ2 = µ1 + µ3 and conclude that the mean for loom 2 equals the
average of the means for looms 1 and 3.
8
Prior to performing the analysis of variance, it is wise to check the validity of
the assumptions (“model diagnostic checking”). It can be done by examining
the residuals.
Definition. The residual for ijth observation is eij = yij − ŷij where ŷij is
the fitted value, the estimate of the ijth observation, ŷij = µ̂i = ȳi. . Thus,
eij = yij − ȳi. .
To verify the independence assumption, plot residuals in time order (if possi-
ble). If a pattern is detected, then there is a correlation between the residuals.
The pattern might be a run of positive residuals, then a run of negatives;
a megaphone a linear pattern. If the plot is structureless, the residuals are
independent.
(a) To verify for equality of variances, plot residuals against the fitted values.
Again, the plot should show no structure.
(b) To test the homogeneity of variance, perform the Bartlett test (see pages
84-85 and SAS output). The hypotheses of interest are H0 : σ12 = σ22 =
· · · = σa2 and H1 : H0 is false for at least one σi2 .
Operators
Looms 1 2 3
1 88 93 90
2 90 92 92
3 91 96 94
Notice that each loom is tested for each operator, that is, each block contains
all treatments. This defines a randomized complete block design.
9
4-1.1. Statistical Analysis of the RCBD.
Notation.
∑
b
yi.
yi. = yij , ȳi. = , i = 1, . . . , a,
j=1
b
∑
a
y.j
y.j = yij , ȳ.j = , j = 1, . . . , b,
i=1
a
∑
a ∑
b ∑
a ∑
b
y..
y.. = yij = yi. = y.j , ȳ.. = , N = ab.
i=1 j=1 i=1 j=1
N
We express the total corrected sum of squares as
∑
a ∑
b ∑
a ∑
b
SST = (yij − ȳ.. ) =
2
[(ȳi. − ȳ.. )+(ȳ.j − ȳ.. )+(yij − ȳi. − ȳ.j + ȳ.. )]2
i=1 j=1 i=1 j=1
∑
a ∑
b ∑
a ∑
b
=b (ȳi. − ȳ.. ) + a
2
(ȳ.j − ȳ.. ) +
2
(yij − ȳi. − ȳ.j + ȳi. )2
i=1 j=1 i=1 j=1
∑
a ∑
b ∑
a ∑
b
+2 (ȳi. − ȳ.. )(ȳ.j − ȳ.. ) + 2 (ȳi. − ȳ.. )(yij − ȳi. − ȳ.j + ȳi. )
i=1 j=1 i=1 j=1
∑
a ∑
b
+2 (ȳ.j − ȳ.. )(yij − ȳi. − ȳ.j + ȳi. )
i=1 j=1
= {the last three cross products are zero!} = SStr + SSbl + SSE
where SStr is the sum of squares due to treatments, SSbl is the sum of squares
due to blocks, and SSE is the sum of squares due to error. Define the mean
squares by M Str = SS tr
a−1
, M Sbl = SS
b−1
bl SSE
, and M SE = (b−1)(a−1) . It can be
shown that ∑
b ai=1 τi2
E(M Str ) = σ +
2
a−1
10
∑b
a j=1 βj2
E(M Sbl ) = σ 2 +
b−1
E(M SE ) = σ . 2
Operators
Looms 1 2 3 Totals
1 88 93 90 271
2 90 92 92 274
3 91 96 94 281
Totals 269 281 276 826
∑∑ 2 2 ∑ yi.2
a = b = 3, SST = yij − yab.. = 75854 − 682276
9
≈ 45.56, SStr = b
−
2 ∑ y 2 2
y..
ab
= 227478
3
− 682276
9
≈ 75826 − 75808.44 = 17.56, SSbl = .j
a
− yab.. ≈
227498
3
−75808.44 = 24.23, SSE = SST −SStr −SSbl = 45.56−17.56−24.23 =
3.77, M Str = SS tr
a−1
= 17.56
2
= 8.78, M Sbl = SS bl
b−1
= 24.23
2
≈ 12.12, M SE =
SSE
(a−1)(b−1)
= 4 ≈ 0.94, F = M SE = 0.94 ≈ 9.34. The ANOVA table is
3.77 M Str 8.78
Source of Variation SS DF MS F
Looms 17.56 2 8.78 9.34
Operators 24.23 2 12.12
Error 3.77 4 0.94
Total 45.56 8
11
to error.
Operators yi..
Batches 1 2 3 4 5
1 A=-1 B=-5 C=-6 D=-1 E=-1 -14
2 B=-8 C=-1 D=5 E=2 A=11 9
3 C=-7 D=13 E=1 A=2 B=-4 5
4 D=1 E=6 A=1 B=-2 C=-3 3
5 E=-3 A=5 B=-5 C=4 D=6 7
y..k -18 18 -4 5 9 10=y...
Definition. The statistical model for this design is yijk = µ + αi + τj + βk +
εijk , i, j, k = 1, . . . , p, where yijk is the observation in the ith row and kth
column for the jth treatment, µ is the overall mean, αi is the ith row effect,
τj is the jth treatment effect, βk is the kth column effect, and εijk is a random
error. It is assumed that εijk ’s are i.i.d. N (0, σ 2 ). Notice that only two out of
the three subscripts are necessary to identify an observation.
∑p This
∑p model is
∑p The assumptions on the effect terms are i=1 αi = 0,
additive. j=1 τj = 0,
and k=1 βk = 0.
We are interested in testing for zero treatment effect, that is, H0 : τ1 = τ2 =
· · · = τp = 0 versus H1 : τj ̸= 0 for some j.
The ANOVA table for the Latin square design is
Source SS DF MS F
∑p y2 2
Treatments SStr = j=1 p.j. − yp...2 p−1 SStr M Str
∑ y2 2
p−1 M SE
Rows SSrows = pi=1 pi.. − yp...2 p−1 SSrows
∑ y2 2
p−1
Columns SScol = pk=1 ..k
p
− yp...2 p−1 SScol
p−1
Error SSE (by subtraction) (p − 2)(p − 1) SSE
∑ ∑ ∑ 2 2
(p−2)(p−1)
Total SST = i j k yijk − y...
p2
p2 − 1
If the test statistic F > Fα, p−1, (p−2)(p−1) , the null is rejected. In addition,
we might want to test for no row effect and no column effect by forming the
12
ratios of M Srow or M Scol to M SE . However, since the rows and columns
represent restrictions on randomization, these tests may not be appropriate.
2
Example. In our example, p = 5, SST = 680 − 10 25
= 676, SSbatches =
(−14)2 +92 +52 +32 +72 102 (−18)2 +182 +(−4)2 +52 +92 2
5
− 25 = 68, SSoper = 5
− 10
25
= 150.
Formulation Total
A y.1. = 18
B y.2. = −24
C y.3. = −13
D y.4. = 24
E y.5. = 5
182 +(−24)2 +132 +242 +52 2
SSf orm = 5
− 10
25
= 330, SSE = 128. The ANOVA table is
Source SS DF MS F
Formulations 330 4 82.5 7.73
Batches 68 4 17
Operators 150 4 37.5
Error 128 12 10.67
Total 676 24
F = 7.73 > F.05, 4, 12 = 3.26, therefore, we reject H0 and conclude that there
is a significant difference between the formulations. Also, MMSSoper
E
= 3.51, in-
M Sbatches
dicating that there are differences between operators, while M SE = 1.59
implies no difference between batches. So, blocking on operators is reason-
able, whereas blocking on batches is unnecessary (though advisable).
13
ith row, Latin letter j, Greek letter k, and lth column, µ is the overall
mean, θi is the ith row effect, τj is the effect of Latin letter j treatment,
ωk is the effect of Greek letter k blocking factor, Ψl is the lth column ef-
fect, and εijkl ’s are i.i.d. N (0, σ 2 ) errors. Two subscripts suffice to iden-
tify an observations. Græco-Latin square designs exist for all p ≥ 3 except
p∑= 6. The ∑ model is additive.
∑p The assumptions
∑p on the effect terms are
p p
θ
i=1 i = 0, τ
j=1 j = 0, k=1 kω = 0, and l=1 l = 0.
Ψ
We are interested in testing for zero treatment effect, that is, H0 : τ1 = τ2 =
· · · = τp = 0 versus H1 : τj ̸= 0 for some j.
The ANOVA table for the Græco-Latin square design is
Source SS DF MS F
∑p y2 2
Treatments SSL = j=1 .j.. − yp....
2 p−1 M SL
∑p y..k.
p
2 2
M SE
Greek letter SSG = k=1 p − p2 y....
p−1
∑ y2 2
Rows SSrows = pi=1 i... − yp....
2 p−1
∑p y...l
2
p
2
Columns SScol = l=1 p − p2 y....
p−1
Error SSE (by subtraction) (p − 3)(p − 1)
∑ ∑ ∑ ∑ 2 2
Total SST = i j k l yijkl − y....
p2
p2 − 1
If the test statistic F > Fα, p−1, (p−3)(p−1) , the null is rejected. In addition, we
might want to test for no row effect, or no column effect, or no Greek let-
ter factor effect by forming the ratios of M Srows or M Scol or M SG to M SE .
However, since the blocks represent restrictions on randomization, these tests
may not be appropriate.
Source SS DF MS F
Formulations 330 4 82.5 10.0
Batches 68 4 17
Operators 150 4 37.5
Assemblies 62 4 15.5
Error 66 8 8.25
Total 676 24
14
F = 10 > F.05, 4, 8 = 3.84, therefore, we reject H0 and conclude that there
is a significant difference between the formulations. Also, MMSSoper
E
= 4.55, in-
M Sbatches
dicating that there are differences between operators, while M SE = 2.06
and MM Sassem
SE
= 1.88 imply no difference between batches or test assemblies.
So, blocking on operators is reasonable, whereas blocking on batches and
assemblies is unnecessary (though advisable).
Example. A chemical engineer suspects that the time of reaction for a chem-
ical process is a function of the type of catalyst employed. Four catalysts
are investigated. The experiment consists of taking a batch of raw material,
loading the pilot plant, applying each catalyst separately, and observing the
reaction time. The batches of the raw material are used as blocks. The
order in which the catalysts are run in each block is randomized. However,
each batch is only large enough for three catalysts to be run. Therefore, an
incomplete block design must be used.
Definition. An incomplete block design is a randomized block design, in
which every treatment is not present in every block.
Definition. A balanced incomplete block design is an incomplete block de-
sign in which any two treatments appear together an equal number of times.
Example (continued...). The balanced incomplete block design for this
experiment is
15
N (0,∑σ 2 ). This is an∑
additive model. The assumptions on the effect terms
are ai=1 τi = 0 and bj=1 βj = 0.
We are interested in testing for zero treatment effect, that is, H0 : τ1 = τ2 =
· · · = τa = 0 versus H1 : τi ̸= 0 for some i.
Derivation of the test statistic.
∑∑ y..2
SST = yij2 − = SStr(adj) + SSbl + SSE
i j
N
where the sum of squares for treatments is adjusted to separate the treatment
and the block effects. This adjustment is necessary because each treatment
is represented in a different set of r blocks.
∑ y2 2
The block sum of squares SSbl = bj=1 k.j − yN.. has b − 1 degrees of freedom.
The adjusted treatment sum of squares is
∑
k ai=1 Q2i
SStr(adj) =
λa
∑
where Qi = yi. − k1 b
j=1 nij y.j , i = 1, . . . , a with nij = 1 if treatment i ap-
pears in block j and nij = 0 otherwise. Qi ’s are called the adjusted treatment
totals and always sum up to zero.
SStr(adj) has a − 1 degrees of freedom. The error sum of squares is computed
by subtraction; it has N − a − b + 1 degree of freedom. The test statistic is
MS
F = Mtr(adj)
SE
. The null hypothesis is rejected if F > Fα, a−1, N −a−b+1 .
16
Source of Variation SS DF MS F
Catalysts 22.75 3 7.58 11.66
Batches 55.00 3
Error 3.25 5 0.65
Total 81.00 11
The test statistic F = 11.66 > F0.05, 3, 5 = 5.41, therefore, the null hypothesis
of no treatment effect is rejected, and we conclude that the catalyst employed
has a significant effect on the time of reaction. Now, to test whether there is
a blocking effect, compute
SSbl(adj) /(b − 1)
=⇒ = 33.89.
SSE /(N − a − b + 1)
We conclude that it is reasonable to use batches as the blocking factor.
Concentration
Temperature 40 60 80
50 17 16 24
20 21 22
75 12 18 17
9 13 12
100 16 18 25
12 21 23
17
∑a ∑b
i=1 (τ β)ij = 0, j = 1, . . . , b, and j=1 (τ β)ij = 0, i = 1, . . . , a.
The hypotheses of interest are H0 : τi = 0 ∀i, H0 : βj = 0 ∀j, or
H0 : (τ β)ij = 0 ∀i, j. The ANOVA table for the analysis is
Source SS DF F
∑a2
yi.. 2
Proposition. The estimated effect of the ith level of factor A is ȳi.. , that of
the jth level of factor B is ȳ.j. , and that of their interaction is ȳij. .
Proof: The model parameter estimates for a two-factor factorial design are
(see Section 5-3.4) µ̂ = ȳ... , τ̂i = ȳi.. − ȳ... , β̂j = ȳ.j. − ȳ... , and (τˆβ)ij =
ȳij. − ȳi.. − ȳ.j. + ȳ... .
The estimated main effect of the ith level of factor A is µ̂ + τ̂i = ȳ... +
ȳi.. − ȳ... = ȳi.. . Likewise, the effect of the jth level of factor B is esti-
mated by ȳ.j. . The estimate of the observation in the ijth cell is given by
ŷijk = µ̂ + τ̂i + β̂j + (τˆβ)ij = ȳij. .
Definition. A main effect plot displays the estimated values for different
levels of a factor.
In our example, the estimates for factor A are ȳ1.. = 20, ȳ2.. = 13.5, ȳ3.. =
19.17, and the estimates for factor B are ȳ.1. = 14.33, ȳ.2. = 17.83, ȳ.3. = 20.5
Definition. An interaction plot displays the estimated values for different
treatment-treatment combinations.
In our example, these estimated values are ȳ11. = 18.5, ȳ12. = 18.5, ȳ13. =
23.0, ȳ21. = 10.5, ȳ22. = 15.5, ȳ23. = 14.5, ȳ31. = 14.0, ȳ32. = 19.5, ȳ33. =
24.0.
18
Definition. The 22 factorial design is a design with two factors A and B,
each at two levels. The levels of the factors may be arbitrarily called “low”
and “high.”
Example. In a chemical reaction, the reactant concentration is factor A run
at two levels, 15% and 25%, and the catalyst is factor B, with two levels,
one bag used or two bags used. The experiment is replicated three times,
and the data are
Replicate
Treatments I II III Total
A low, B low 28 25 27 (1) = 80
A high, B low 36 32 32 a = 100
A low, B high 18 19 23 b = 60
A high, B high 31 30 29 ab = 90
The effect of treatment A at the low level of B is [a − (1)]/n and the effect of
A at the high level of B is [ab − b]/n. Therefore, the main effect of treatment
A is the average of this two quantities
1 1 [contrast]
A= [ab − b] + [a − (1)] = [a + ab − (1) − b] = .
2n 2n 2n
Likewise, the main effect of treatment B is
1 1
B= [ab − a] + [b − (1)] = [b + ab − (1) − a].
2n 2n
The interaction between A and B is the average difference between the effect
of A at the high level of B and the effect of A at the low level of B. Thus,
1 1
AB = [ab − b] − [a − (1)] = [(1) + ab − a − b].
2n 2n
Remark. Alternatively, AB can be defined as the average difference be-
tween the effect of B at the high level of A and the effect of B at the low
level of A. Both definitions lead to the same equation.
To test for main and interaction effects, compute the sum of squares
[contrast]2 ∑∑∑ y2
SS = , SST = 2
yijk − ... ,
4n 4n
SSE = SST − SSA − SSB − SSAB .
Example (continued...) The ANOVA table is
Source SS DF MS F
A 208.33 1 208.33 53.15
B 75.00 1 75.00 19.13
AB 8.33 1 8.33 2.13
Error 31.34 8 3.92
Total 323.00 11
19
F0.05, 1, 8 = 5.32. There are main effects of A and B but no interaction.
Remark. To coefficients for estimating the effects are
Effect (1) a b ab
A -1 +1 -1 +1
B -1 -1 +1 +1
AB +1 -1 -1 +1
Replicate
A B I II III IV
- - 18.2 18.9 12.9 14.4
+ - 27.2 24.0 22.4 22.5
- + 15.9 14.5 15.1 14.2
+ + 41.0 43.0 36.3 39.9
6.3. The 23 Factorial Design.
For example,
1 [contrast]
A= [a + ab + ac + abc − (1) − b − c − bc] = .
4n 4n
To test the main and interaction effects, compute
[contrast]2 ∑∑∑∑ y2
SS = , SST = 2
yijkl − .... , SSE by subtraction.
8n 8n
Example. The following data were obtained by running two replicates of a
23 design. Analyze the data and draw conclusions.
20
Treatment Replicate
Combination I II
(1) 18.2 18.9
a 12.9 14.4
b 27.2 24.0
ab 22.4 22.5
c 15.9 14.5
ac 15.1 14.2
bc 41.0 43.0
abc 36.3 39.9
Day 1 Day 2
Concentration Concentration
Temperature 40 60 80 40 60 80
50 17 16 24 20 21 22
75 12 18 17 9 13 12
100 16 18 25 12 21 23
21
Example (continued...). y..1 = 163, y..2 = 153, SSblocks = (163)2 /9 +
(153)2 /9 − (316)2 /18 = 5.56.The ANOVA table is
Source SS DF MS F
Temperature 150.11 2 75.06 10.45
Concentration 114.78 2 57.39 7.99
Interaction 40.55 4 10.14 1.41
Days 5.56 1 5.56 (0.77)
Error 57.44 8 7.18
Total 368.44 17
F0.05,2,8 = 4.46, F0.05,4,8 = 3.84, therefore, we conclude that there are main
effects, but no interaction present.
Batch
Treatments 1 2 3
(1) 28 25 27
a 36 32 32
b 18 19 23
ab 31 30 29
Total 113 106 111
The sum of squares for the main effects and the interactions are computed
as in the 2k factorial design. The sum of squares for blocks is SSblocks =
∑n Bi2 2
Source SS DF MS F
A 208.33 1 208.33 50.32
B 75.00 1 75.00 18.12
AB 8.33 1 8.33 2.01
Blocks 6.5 2 6.5 (1.57)
Error 24.84 6 4.14
Total 323.00 11
22
general, 2p incomplete blocks (p < k). In this case certain treatment effects
(usually high-order interactions) cannot be distinguished from blocks or are
confounded with blocks.
replicates 2
Total 323.00 11
23
How to assign treatment combinations to the two blocks in the 2k
design with a certain combination being confounded?
Remark. Another effect must be confounded. Since four blocks have three
24
degrees of freedom, three effects should be confounded with blocks. To find
the third confounded effect compute the generalized interaction which is de-
fined as the product of the two effects modulus 2. Since the confounded
effects are constant in a block (equal either 1 or -1), their product is a con-
stant in a block (either 1 or -1), and, thus, is confounded with the block.
Example. Also (ABC)(BCD) = AD must be confounded.
Error 130.25 3
Total 323.00 11
25
In this case the fractional factorial design can be run, which is a fraction of
the complete design.
Example. Suppose that experimenters cannot afford all eight runs of a
23 design, but can afford four runs. Therefore, a one-half fraction of the 23
design is run. It is called 23−1 design.
Suppose treatments a, b, c, and abc are chosen for the experiment. From
the table of plus and minus signs, these treatments correspond to the plus
signs in the ABC column. The combination ABC is called the generator
of this fraction. Because the identity I always has the positive sign, the
defining relation for this fraction is I = ABC.
From the table, the linear combinations used to estimate the main effects of
A, B, and C are
a − b − c + abc −a + b − c + abc
lA = = lBC , lB = = lAC ,
2 2
and
−a − b + c + abc
lC = = lAB .
2
Thus, the effects of A and BC, B and AC, and C and AB are indistin-
guishable. These pairs are called aliases. When estimating A, we are really
estimating A + BC, etc.
To find the alias to a treatment combination, multiply (modulus 2) the defin-
ing relation by this treatment. For example, A · I = A · ABC = BC.
A fractional factorial designs are set up in such a way that by running addi-
tional fractional designs, one gets a complete replicate of a factorial design.
Example. Terms (1), ab, ac, and bc could have been chosen for the one-half
fractional design. The defining relation of this design is I = −ABC. The
aliases are AB · I = −AB · ABC = −C, AC · I = −B, and BC · I = −A.
Thus, by estimating A, for example, we really estimate A − BC.
Notice that combining the two described one-half fractions, we get a com-
plete replicate of the 23 design.
Example. A 23−1 design with defining relation I = ABC produced the
26
following data. Find the important effects.
Treatment Observation
a 3
b 4
c 7
abc 5
(a − b − c + abc)2
SSA+BC = = 9/4 = 2.25, SSB+AC = 1/4 = 0.25,
4
SSC+AB = 25/4 = 6.25.
The main effects of C and possibly A are important.
27
In this model, a levels of factor A and b levels of factor B are randomly
chosen. The model is yij = µ + τi + βj + (τ β)ij + εij , where τi , βj , (τ β)ij , and
εij are independent normal random variables with mean zero and variances,
respectively, στ2 , σβ2 , στ2β , and σ 2 . We are interested in testing H0 : στ2 = 0
against H1 : στ2 > 0; H0 : σβ2 = 0 against H1 : σβ2 > 0; and H0 : στ2β = 0
against H1 : στ2β > 0.
It can be shown that E(M SA ) = σ 2 + nστ2β + bnστ2 , E(M SB ) = σ 2 + nστ2β +
anσβ2 , E(M SAB ) = σ 2 + nστ2β , and E(M SE ) = σ 2 .
Thus, the test statistic for H0 : στ2β = 0 is F = M SAB /M SE which has the
F distribution with (a − 1)(b − 1) and ab(n − 1) degrees of freedom.
The statistic for H0 : στ2 = 0 is F = M SA /M SAB which has the F distribu-
tion with a − 1 and (a − 1)(b − 1) degrees of freedom.
For testing H0 : σβ2 = 0 the test statistic is F = M SB /M SAB which has the
F distribution with b − 1 and (a − 1)(b − 1) degrees of freedom.
The estimators of the variance components are σ̂ 2 = M SE , σ̂τ2β = (M SAB −
M SE )/n, σ̂τ2 = (M SA − M SAB )/bn, and σ̂β2 = (M SB − M SAB )/an.
Example. It is suspected that the strength of a fabric depends on looms
(factor A) and operators’ experience (factor B). Five looms and four opera-
tors are randomly chosen from a large number of looms and operators in a
factory. Every operator works on every loom producing three samples of fab-
ric. The data yield SSA = 23.6, SSB = 17.8, SSAB = 5.6, and SSE = 12.0.
(a) Analyze the data.
M SAB /M SE = 1.56, M SA /M SAB = 12.64, M SB /M SAB = 12.71, a =
5, b = 4, n = 3, F0.05, 12, 40 = 2.00, F0.05, 4, 12 = 3.26, F0.05, 3, 12 = 3.49
(b) Estimate the variance components.
σ̂ 2 = 0.3, σ̂τ2 = 0.45, σ̂β2 = 0.36, σ̂τ2β = 0.06
28
(6) εijk ’s are N (0, σ 2 ).
∑a
bn τ2
It can be shown that E(M SA ) = σ 2 + nστ2β + a−1 i=1 i
, E(M SB ) = σ 2 + anσβ2 ,
E(M SAB ) = σ + nστ β , and E(M SE ) = σ .
2 2 2
29
numbered 1 through 6.
Statistical Analysis.
Here are the expected values of the mean squares depending on whether
factors are fixed or random.
A Fixed A Fixed A Random
E(M S) B Fixed
∑
B Random∑ B Random
bn τi2 bn τ 2
E(M SA ) 2
σ + ∑a−1
∑
σ + nσβ2 + a−1 i
2
σ + nσβ2 + bnστ2
2
n 2
βj(i)
E(M SB(A) ) σ2 + a(b−1)
σ 2 + nσβ2σ 2 + nσβ2
E(M SE ) σ 2
σ2 σ2
∑a
Case 1. A fixed, B fixed. The model constraints are i=1 τi = 0 and
∑b
j=1 βj(i) = 0, i = 1, . . . , a. The hypothesis H0 : τi = 0 is tested by
M SA /M SE , and H0 : βj(i) = 0 is tested by M SB(A) /M SE . ∑
Case 2. A fixed, B random. The model assumptions are ai=1 τi = 0 and
βj(i) are i.i.d. N (0, σβ2 ). Test statistic for H0 : τi = 0 is M SA /M SB(A) and
that for H0 : σβ2 = 0 is M SB(A) /M SE .
Case 3. A random, B random. Model assumptions are τi are i.i.d. N (0, στ2 )
and βj(i) are i.i.d. N (0, σβ2 ). Test statistic for H0 : στ2 = 0 is M SA /M SB(A)
and that for H0 : σβ2 = 0 is M SB(A) /M SE .
Example. In our example, both A and B are fixed. The ANOVA table
is
Source SS DF MS F
Make 1401.17 2 700.58 110.68
Model (within Make) 309.5 3 103.17 16.29
Error 38 6 6.33
Total 1748.67 11
30
Statistical Model The model is yij = µ + τi + β(xij − x̄.. ) + εij , where
iid ∑
i = 1, . . . , a, j = 1, . . . , n, εij ∼ N (0, σ 2 ), and ai=1 τi = 0. To obtain the
least-squares estimates of the parameters µ, β, and τi , minimize the sum of
squares
∑ a ∑ n
( )2
yij − µ̂ − τ̂i − β̂(xij − x̄.. )
i=1 j=1
∑
under the assumption that ai=1 τ̂i = 0. Solving the system of normal equa-
tions for µ̂ and τ̂i , arrive at the estimates
or
Sxy − Txy Exy
β̂ = =
Sxx − Txx Exx
where
∑
a ∑
n
Sxx = (xij − x̄.. )2 ,
i=1 j=1
∑
a ∑
n ∑
a ∑
n
Sxy = (xij − x̄.. )(yij − ȳ.. ) = yij (xij − x̄.. ),
i=1 j=1 i=1 j=1
∑
a ∑
n ∑
a
Txx = (x̄i. − x̄.. )(xij − x̄.. ) = n (x̄i. − x̄.. )2 ,
i=1 j=1 i=1
∑
a ∑
n ∑
a ∑
n ∑
a
Txy = (x̄i. −x̄.. )(yij −ȳ.. ) = ȳi. (xij −x̄.. ) = n (x̄i. −x̄.. )(ȳi. −ȳ.. ).
i=1 j=1 i=1 j=1 i=1
31
The ANCOVA table.
∑
a ∑
n
y..2 ∑a
yi.2 y2
SST = yij2 − , SStr = − .. ,
i=1 j=1
an i=1
n an
SSE = SST − SStr .
The sums of squares adjusted to the presence of the covariate are
2
Sxy
SST (adj) = SST − , dfT (adj) = an − 2,
Sxx
2
Exy
SSE(adj) = SSE − , dfE(adj) = a(n − 1) − 1,
Exx
SStr(adj) = SST (adj) − SSE(adj) , dftr(adj) = a − 1.
The test statistic for testing H0 : τ1 = τ2 = · · · = τa = 0 againts H1 : τi ̸= 0
for some i is
SStr(adj) /(a − 1) ( )
F = ∼ F a − 1, a(n − 1) − 1) .
SSE(adj) /(a(n − 1) − 1)
Shop
1 2 3
x y x y x y
110 40 60 25 62 27
75 38 75 32 90 24
93 30 38 13 45 20
98 47 140 35 59 13
32
Sxx = 9278.25, Sxy = 2351, Txx = 1801.5, Txy = 1072.25, Exy = 1278.75, Exx =
7476.75, β̂ = 0.17, τ̂1 = 7.48, τ̂2 = −2.33, τ̂3 = −5.14. SST = 1208.67, SStr =
665.17, SSE = 543.5, SST (adj) = 612.95, SSE(adj) = 324.80, SStr(adj) =
288.15, SSslope = 218.70, σ̂ 2 = 40.60.
The ANCOVA table is
Source SS DF MS F Fcr
Treatment(adj) 288.15 2 144.08 3.55 < 4.46
(Slope) (218.70) (1) (218.70) (5.39) > 5.32
Error(adj) 324.80 8 40.60
Total(adj) 612.95 10
Source SS DF MS F Fcr
Treatment 665.17 2 332.58 5.507 > 4.26
Error 543.5 9 60.39
Total 1208.67 11
The conclusion of the ANOVA analysis is that the shops differ significantly.
In this design, half of the experimental units receive treatment A, then, after
a wash-out period, treatment B; the other half of the units receive treatment
B first, and then, after the wash-out period, treatment A.
33
Period Treatment Group 1 Total
1 A y111 y121 . . . y1n1 1 y1·1
2 B y112 y122 . . . y1n1 2 y1·2
Difference D11 D12 . . . D1n1 G1
where µ is the overall mean, αi is the i-th group effect, i = 1 or 2, βij is the
iid
effect of the j-th subject from group i, j = 1, . . . , ni , βij ∼ N (0, σβ2 ), γk is
the k-th period effect, k = 1 or 2, τl is the l-th treatment effect, l = 1 or 2
iid
depending on i and k, and εijkl ∼ N (0, σ 2 ). The parameters of this model
are µ, αi , σβ2 , γk , τl and σ 2 . We are interested in testing H0 : τ1 = τ2 = 0
against H1 : τ1 ̸= 0 and τ2 ̸= 0.
(n2 G1 − n1 G2 )2
SStr = , dftr = 1,
2n1 n2 (n1 + n2 )
1( ∑ ∑ )
n
1 2n
1 1
SSE = 2
D1j + 2
D2j − G21 − G22 , dfE = n1 + n2 − 2,
2 j=1 j=1
2n 1 2n 2
M Str
F = ∼ F (1, n1 + n2 − 2).
M SE
When n1 = n2 = n, the formulas simplify to become
(G1 − G2 )2
SStr = , dftr = 1,
4n
and
1 ∑∑ 2 1 ( 2 )
2 n
SSE = Dij − G1 + G22 , dfE = 2(n − 1).
2 i=1 j=1 2n
Example. Two drugs A or B are applied to subjects and the reaction time
(in seconds) to certain stimulus is measured. There are inherent differences
34
in reaction time among individuals, therefore, a cross-over design is used with
a one-week wash-out period. The data are
Group 1 Subject
Period Drug 1 2 3 4 Total
1 A 30 57 52 66 205
2 B 28 50 38 49 165
Difference 2 7 14 17 40
Group 2 Subject
Period Drug 1 2 3 4 Total
1 B 34 32 18 28 112
2 A 41 21 27 36 125
Difference -7 11 -9 -8 -13
35
STAT 530 SAS CODES AND OUTPUTS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SAS Output
The Difference in Fabric Strength for the Three Looms
Sum of
Source DF Squares Mean Square F Value Pr > F
1
3.5.7. Comparing Pairs of Treatment Means.
SAS Code
title 'The Difference in Fabric Strength for the Three Looms';
data textile;
input loom strength;
cards;
1 88
1 93
1 90
1 89
2 91
2 89
2 92
2 94
3 97
3 96
3 94
3 93
;
SAS Output
95% Confidence
loom N Mean Limits
2
The Difference in Fabric Strength for the Three Looms
Difference
loom Between 95% Confidence
Comparison Means Limits
Alpha 0.05
Error Degrees of Freedom 9
Error Mean Square 4.111111
Critical Value of Studentized Range 3.94850
Minimum Significant Difference 4.003
A 95.000 4 3
A
B A 91.500 4 2
B
B 90.000 4 1
Alpha 0.05
Error Degrees of Freedom 9
Error Mean Square 4.111111
Critical Value of t 2.26216
Least Significant Difference 3.2433
A 95.000 4 3
B 91.500 4 2
B
B 90.000 4 1
3
Duncan's Multiple Range Test for strength
Alpha 0.05
Error Degrees of Freedom 9
Error Mean Square 4.111111
Number of Means 2 3
Critical Range 3.243 3.385
A 95.000 4 3
B 91.500 4 2
B
B 90.000 4 1
4
3.5.5. Orthogonal Contrasts.
SAS Code
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SAS Output
Sum of
Source DF Squares Mean Square F Value Pr > F
5
3.4. Model Adequacy Checking.
SAS Code
SAS Output
6
7
Goodness-of-Fit Tests for Normal Distribution
Test Statistic DF p Value
Kolmogorov-Smirnov D 0.12387579 Pr > D >0.150
Cramer-von Mises W-Sq 0.03377973 Pr > W-Sq >0.250
Anderson-Darling A-Sq 0.24883072 Pr > A-Sq >0.250
Chi-Square Chi-Sq 1.73172167 2 Pr > Chi-Sq 0.421
8
Bartlett's Test for Homogeneity
of strength Variance
Source DF Chi-Square Pr > ChiSq
loom 2 0.0792 0.9612
9
4.1. The Randomized Complete Block Design.
SAS Code
data RCBD;
input loom operator strength @@;
datalines;
1 1 88 1 2 93 1 3 90
2 1 90 2 2 92 2 3 92
3 1 91 3 2 96 3 3 94
;
proc anova;
class loom operator;
model strength = loom operator;
run;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SAS Output
10
4.2. The Latin Square Design.
SAS Code
data LATIN_SQUARE;
input batch operator formulation $ force @@;
datalines;
1 1 A -1 1 2 B -5 1 3 C -6 1 4 D -1 1 5 E -1
2 1 B -8 2 2 C -1 2 3 D 5 2 4 E 2 2 5 A 11
3 1 C -7 3 2 D 13 3 3 E 1 3 4 A 2 3 5 B -4
4 1 D 1 4 2 E 6 4 3 A 1 4 4 B -2 4 5 C -3
5 1 E -3 5 2 A 5 5 3 B -5 5 4 C 4 5 5 D 6
;
proc anova;
class batch operator formulation;
model force = batch operator formulation;
run;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SAS Output
Source DF Squares Mean Square F Value Pr > F
11
4.3. The Græco-Latin Square Design.
SAS Code
data GRAECO_LATIN;
input batch operator formulation $ assembly $ force @@;
datalines;
1 1 A a -1 1 2 B c -5 1 3 C e -6 1 4 D b -1 1 5 E d -1
2 1 B b -8 2 2 C d -1 2 3 D a 5 2 4 E c 2 2 5 A e 11
3 1 C c -7 3 2 D e 13 3 3 E b 1 3 4 A d 2 3 5 B a -4
4 1 D d 1 4 2 E a 6 4 3 A c 1 4 4 B e -2 4 5 C b -3
5 1 E e -3 5 2 A b 5 5 3 B d -5 5 4 C a 4 5 5 D c 6
;
proc anova;
class batch operator formulation assembly;
model force = batch operator formulation assembly;
run;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SAS Output
Source DF Squares Mean Square F Value Pr > F
12
4.4. The Balanced Incomplete Block Design.
SAS Code
data BIBD;
input catalyst batch time @@;
datalines;
1 1 73 1 2 74 1 4 71
2 2 75 2 3 67 2 4 72
3 1 73 3 2 75 3 3 68
4 1 75 4 3 72 4 4 75
;
proc glm;
class catalyst batch;
model time=batch catalyst;
run;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SAS Output
Source DF Squares Mean Square F Value Pr > F
13
5.3.2. The Two-Factor Factorial Design: Fixed-Effects Model.
SAS Code
data factorial_design;
input temp conc yield @@;
datalines;
1 1 17 1 1 20 1 2 16 1 2 21 1 3 24 1 3 22
2 1 12 2 1 9 2 2 18 2 2 13 2 3 17 2 3 12
3 1 16 3 1 12 3 2 18 3 2 21 3 3 25 3 3 23
;
proc glm;
class temp conc;
model yield=temp conc temp*conc;
lsmeans temp conc/out=maineff;
lsmeans temp*conc/out=intereff;
run;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SAS Output
Error 9 63.000 63.000 7.000
Total 17 368.444
14
LSMEAN
21
20
19
18
17
16
15
14
13
1 2 3
t emp
LSMEAN
21
20
19
18
17
16
15
14
13
1 2 3
conc
15
LSMEAN
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
1 2 3
conc
t emp 1 2 3
16
6.3. The 23 Factorial Design.
SAS Code
data two_cubed;
input temp conc catalyst yield @@;
datalines;
1 1 1 18.2 1 1 1 18.9 2 1 1 12.9 2 1 1 14.4
1 2 1 27.2 1 2 1 24.0 2 2 1 22.4 2 2 1 22.5
1 1 2 15.9 1 1 2 14.5 2 1 2 15.1 2 1 2 14.2
1 2 2 41.0 1 2 2 43.0 2 2 2 36.3 2 2 2 39.9
;
proc glm;
class temp conc catalyst;
model yield=temp | conc | catalyst;
run;
_______________________________________________________________________
SAS Output
Sum of
Source DF Squares Mean Square F Value Pr >
F
17
5.6. Blocking in a Factorial Design.
SAS Code
data one;
input temp day conc yield @@;
datalines;
1 1 1 17 1 1 2 16 1 1 3 24 1 2 1 20 1 2 2 21 1 2 3 22
2 1 1 12 2 1 2 18 2 1 3 17 2 2 1 9 2 2 2 13 2 2 3 12
3 1 1 16 3 1 2 18 3 1 3 25 3 2 1 12 3 2 2 21 3 2 3 23
;
proc glm;
class temp day conc;
model yield=temp conc temp*conc day;
run;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SAS Output
Sum of
Source DF Squares Mean Square F Value Pr > F
18
7.4. Confounding in the 2k Design in Two Blocks.
SAS Code
data one;
input temp conc batch yield @@;
datalines;
1 1 1 28 1 1 3 25 1 1 5 27
2 1 2 36 2 1 4 32 2 1 6 32
2 2 1 31 2 2 3 30 2 2 5 29
1 2 2 18 1 2 4 19 1 2 6 23
;
proc glm;
class temp conc batch;
model yield = temp conc batch;
run;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SAS Output
Sum of
Source DF Squares Mean Square F Value Pr > F
19
13.2. The Two-Way ANOVA Design with Random Effects.
SAS Code
data random_effects;
input temp conc yield @@;
datalines;
1 1 17 1 1 20 1 2 16 1 2 21 1 3 24 1 3 22
2 1 12 2 1 9 2 2 18 2 2 13 2 3 17 2 3 12
3 1 16 3 1 12 3 2 18 3 2 21 3 3 25 3 3 23
;
proc glm;
class temp conc;
model yield=temp conc temp*conc;
random temp conc temp*conc/test;
run;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SAS Output
20
13.3. The Two-Way ANOVA Design with Mixed Effects.
SAS Code
data mixed_effects;
input temp conc yield @@;
datalines;
1 1 17 1 1 20 1 2 16 1 2 21 1 3 24 1 3 22
2 1 12 2 1 9 2 2 18 2 2 13 2 3 17 2 3 12
3 1 16 3 1 12 3 2 18 3 2 21 3 3 25 3 3 23
;
proc glm;
class temp conc;
model yield=temp conc temp*conc;
random conc temp*conc / test;
run;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SAS Output
21
14.1. The Two-Stage Nested Design.
SAS Code
data NESTED;
input make model score @@;
datalines;
1 1 62 1 1 67 1 2 77 1 2 73 2 1 72 2 1 69
2 2 58 2 2 57 3 1 94 3 1 90 3 2 85 3 2 88
;
proc sort;
by make model;
proc nested;
class make model;
var score;
run;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SAS Output
make 4 2 1
model 0 2 1
Error 0 0 1
22
15.3. Analysis of Covariance (ANCOVA).
SAS Code
data ancova;
input shop x y;
xcentered=x-78.75;
cards;
1 110 40
1 75 38
1 93 30
1 98 47
2 60 25
2 75 32
2 38 13
2 140 35
3 62 27
3 90 24
3 45 20
3 59 13
;
proc glm;
class shop;
model y= shop xcentered;
run;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SAS Output
Sum of
Source DF Squares Mean Square F Value Pr > F
23
The Cross-Over Design.
SAS Code
data reaction_time;
input group subject period drug $ time;
cards;
1 1 1 A 30
1 2 1 A 57
1 3 1 A 52
1 4 1 A 66
1 1 2 B 28
1 2 2 B 50
1 3 2 B 38
1 4 2 B 49
2 1 1 B 34
2 2 1 B 32
2 3 1 B 18
2 4 1 B 28
2 1 2 A 41
2 2 2 A 21
2 3 2 A 27
2 4 2 A 36
;
Sum of
Source DF Squares Mean Square F Value Pr >
F
24