Triple Alpha Lattice 12patchank
Triple Alpha Lattice 12patchank
Patchanok Srisuradetchai
Patchanok Srisuradetchai
This writing project has been read by the writing project advisor and has been found
to be satisfactory regarding content, English usage, format, citations, bibliographic
style, and consistency, and is ready for submission to the Statistics Faculty.
Contents
1 INTRODUCTION 3
3 NUMERICAL EXAMPLES 14
3.1 Example of a balanced square lattice design . . . . . . . . . . . . . . 14
3.2 Example of a partially balanced square lattice design . . . . . . . . . 17
B References 40
List of Tables
1 3 × 3 balanced lattice (t = 9, k = 3, r = 4, λ = 1) . . . . . . . . . . . . 6
2 Two orthogonal latin squares of order 3. . . . . . . . . . . . . . . . . 6
3 Analysis of Variance for the balanced square lattice design . . . . . . 8
4 Analysis of Variance for the partially balanced square lattice design . 12
5 Gain in weight for 2 pigs . . . . . . . . . . . . . . . . . . . . . . . . . 14
2
1 INTRODUCTION
For experiments using randomized block designs, all treatment combinations may not
be run in each block because of shortages of experimental units or facilities. Yates
(1936a) formally introduced balanced incomplete block (BIB) designs in which every
treatment is not present in every block, but the number of pairs of each treatment
occurring together is the same. A BIB design can reduce the number of experimental
units used in experiment as we already knew. Although BIB designs are efficient
designs, these designs are still not appropriate for experiments with a large number
of treatments such as animal breeding experiments. Moreover, the minimum number
of blocks required for a BIB design may be too large to be practical. In the same
year, Yates (1936b) proposed a new method of arranging agricultural variety trials
involving a large number of crop varieties. These types of arrangements were named
a quasi-factorial or lattice designs. His paper contained numerical examples based on
the results of a uniformity trial on orange trees. A special feature of lattice designs is
that the number of treatments, t, is related to the block size, k, in one of three forms:
t = k 2 , t = k 3 , or t = k(k + 1). Even though the number of possible treatments
is limited, a lattice design may be an ideal design for field experiments with a large
number of treatments. Although lattice designs have been frequently used, there is
limited software that performs an appropriate statistical analysis for a lattice design.
The SAS package is one of the most commonly-used packages for the design and
analysis of experiments. The use of SAS for analyzing a lattice design was first
discussed in a colloquium on horticulture (Stroup and Paparozzi, 1989). At that time,
PROC MATRIX, PROC IML, and PROC LATTICE, which can analyze experiments
using lattice designs, were only found on main-frame computers. Fernandez G. C.J.
(1990) presented a PC-SAS program for the analyses of data obtained from a lattice
design. His program consisted of two parts. In the first part, PROC GLM was used
to calculate unadjusted block sum of squares (SS), adjusted block SS, unadjusted
treatment SS, and intra-block error. In the second part, PROC MEANS and the
MERGE option were used to calculate many statistics such as adjusted block values
and treatment totals. Now PROC LATTICE is available in PC-SAS and will analyze
data from balanced square lattices, partially balanced square lattices, and some
rectangular lattices.
Besides SAS software, R, a free software environment for statistical computing and
graphics is capable of analyzing experimental design data. Groemping (2011) provides
a summary of R packages related to the design and analysis of experimental data. The
4
R package “agricolae” has the capability to analyze data obtained from lattice designs.
Although it was not specifically created for lattice designs, there is one function
which can be applied to use with lattice designs. Felipe de Mendiburu (2010) wrote
the“agricola” package as a master’s degree project, and it offers extensive functionality
on experimental design especially for plant breeding and agricultural experiments.
The strength of this package is that it allows for the randomization of treatments
in lattice designs, factorial designs, randomized complete block designs, latin square
designs, balanced incomplete block designs, alpha designs, cyclic, augmented block,
and split and strip plot designs. Moreover, this package can also perform an analysis
of variance for many designs. The R “agricolae” package is the newest tool for the
analysis of lattice design data. More details are in a document by Felipe de Mendiburu
(2010).
This paper provides a review of the analysis of two types of square lattice designs:
balanced and partially balanced lattices, as well as numerical examples and the R
and SAS computer code needed to analyze the experimental data. In the last section,
the R function are written to give the complete analysis of variance which both SAS
and R do not provide.
5
all ordered pairs are distinct (See Table 2). From the standard array, the treatment
numbers that fall on the same letter in a latin square are taken to form a block. For
example, from latin square 1 (See Table 2), treatment numbers 1, 6 and 8 fall on
the letter A, so treatments 1, 6 and 8 are in the same block in Replication III (See
Table 1). Analogous to Replication III, Replication IV is constructed from the second
latin square. Another method of constructing lattice square designs can be found in
Federer and Wright (1988) who proposed a simple method for constructing lattice
square designs when the number of treatments is greater than 3.
2.1.2 Randomization
Although the following procedure can be applied to partially balanced designs, there
are some differences which will be discussed later. We will adopt the following
notation. Let
t denote the total number of treatments,
k denote the number of units per block or block size,
s denote the number of blocks per replication which is equal to k,
r denote the number of replications (for balanced designs, r = k + 1).
Let yij(l) denotes the response value of the jth treatment in the lth block within ith
replication, i = 1, 2, . . . , k + 1, j = 1, 2, . . . , k 2 , l = 1, 2, . . . , rk. The model is
where µ, πi , βi(l) , and τj represent the effect of the mean, the replicate, the incomplete
block, and the treatment, respectively. εij(l) is the intra-block residual, assumed to
be normally and independently distributed with mean 0 and variance σe2 .
Various ANOVA sums of squares are now presented:
4. For computing the adjusted block sum of squares, SSBAdj , several quantities
are required to be computed first. Let
Bj denote the sum of block totals for the blocks with treatment j, j = 1, 2, . . . , t,
Tj denote the total of the jth treatment total from all replications,
Wj denote the weight for the jth treatment which is used for adjustment for
block,
Wj = kTj − (k + 1)Bj + G (4)
P P
where G = yij(l) , or the grand total. Note that Wj = 0. The sum of
squares for blocks within replication, adjusted for treatment effects, SSBAdj , is
defined as
Wj2
P
SSBAdj = . (5)
k 3 (k + 1)
5. Intra-block error sum of squares:
Using the various sums of squares above, the analysis of variance (ANOVA)
table is given in Table 3.
It is important to note that the mean square of the unadjusted treatment cannot be
used for testing against the mean square of intra-block error because the mean square
of unadjusted treatment still contains block effects. The adjusted treatment sum of
the squares is defined as
P 0 2
(Tj + µWj )2
P
(Tj )
SST rtAdj = − CF = − CF (7)
r r
9
0
where Tj is the adjusted treatment total defined as Tj + µWj , and µ is the adjustment
factor for error and treatment means defined as
M SBAdj − M SE Eb − Ee
µ= 2
= (8)
k M SBAdj k 2 Eb
If dividing the SST rtAdj by its degree of freedom, k 2 − 1, we will get the M ST rtAdj .
So, the F-statistics is the M ST rtAdj divided by the the intra-block error mean square.
For t-test, the mean square of intra-block error, Ee , needs to be adjusted to take into
account the sampling error. The new mean square is called the “effective error mean
0
squar”, or Ee , which is defined as
0
Ee = Ee (1 + kµ) = Ee [1 + (r − 1)µ]. (9)
The F-statistic is
M ST rtAdj
F = (10)
Ee
The degrees of freedom of the numerator and denominator for the F statistic are
k 2 − 1 and (k − 1)(k 2 − 1), respectively.
0
The variance of the adjusted treatment mean is Ee /r , and the error variance of the
difference between two adjusted treatment means in the same block is
0
2Ee [1 + (r − 1)µ] 2Ee
= (11)
r r
The square root of error variance of the difference between two treatment means is
the standard error used for t-tests between pairs of treatments.
If, however, Eb is less than Ee , then we conclude the blocks have no effect,
and the data will be analyzed as if it were a randomized block design but using
the replications as the blocks. One numerical value that summarizes the potential
advantage or disadvantage of one specific experimental design relative to another is
called a “relative efficiency”. The relative efficiency is expressed as an unbiased
estimator of the error variance that would have been present if the experiment
had been conducted as a randomized block divided by effective error mean square,
0
Ee . The sum of the SSBAdj and SSE, SSBAdj + SSE, is called the “randomized
complete block design (RCBD) error sum of squares” which is an estimate of the
block sum of squares in a randomized block design. The degrees of freedom for
RCBD sum of squares is the sum of the degrees of freedom of SSBAdj and SSE , or
(k 2 − 1) + (k 2 − 1)(k − 1) = rk(k − 1).
10
library(agricolae)
design.lattice(4,type="triple")
$square1
[,1] [,2] [,3] [,4]
[1,] 6 3 8 12
[2,] 11 13 10 15
[3,] 14 7 2 5
[4,] 9 1 4 16
$square2
[,1] [,2] [,3] [,4]
[1,] 15 5 12 16
[2,] 13 7 3 1
[3,] 10 2 8 4
[4,] 11 14 6 9
$square3
[,1] [,2] [,3] [,4]
[1,] 11 7 8 16
[2,] 13 5 6 4
[3,] 10 14 12 1
[4,] 15 2 3 9
11
Computations for the analysis of variance for a partially balanced lattice design is
more complicated than it is for a balanced design. Actually, the partially balanced
square lattices could be considered as partially balanced incomplete block designs
(PBIB). This was shown by Bose and Nair (1939). Nair (1952) used the method of
analysis of a PBIB design for the simple square lattice design. However, this paper
actually presents the method from Cochran and Cox (1950) who simplified the original
method by Yates (1936b). In the analysis, let
t denote the total number of treatments,
k denote the number of units per block (i.e., the block size),
s denote the number of blocks per replication (which equals k), and
r denote the number of replications.
The analysis procedure involves the following steps:
1. The total sum of squares (SST ot), the unadjusted treatment sum of squares
(SST rtU ), and the replication sum of squares (SSR) are computed in the same
way as those in balanced designs.
2. Find (1) the block total, Bl , l = 1, 2, . . . , rk, (2) the replication total, Ri ,
i = 1, 2, . . . , r, (3) the treatment total, Tj , j = 1, 2, . . . , k 2 , and (4) the grand
total G.
From these sums of squares, the analysis of variance table is shown in Table 4.
From Table 4, the mean square of the unadjusted treatment, however, cannot be
12
Table 4: Analysis of Variance for the partially balanced square lattice design
used for testing against the mean square of intra-block error in an F test. Instead,
the unadjusted treatment mean square can be used for testing the data as if the
experiment were in randomized block. The denominator for the F-test is the pooled
mean square for adjusted blocks and intra-block error. For lattice designs, if we want a
test for the treatment effects, the treatment totals must be adjusted. The adjustment
factor, similar to the weight in a balanced lattice, is
M SBAdj − M SE Eb − Ee
µ= = . (14)
k(r − 1)M SBAdj k(r − 1)Eb
0
Then, the adjusted treatment total, Tj , is defined as
r
0
X
Tj = Tj + µ Ci (in Block l containing Trt j). (15)
i=1
0
Then, for a simple lattice, Tj = Tj + µ[C1∗ + C2∗ ], where C1∗ and C2∗ are the values
of C’s in the particular blocks containing the treatment jth in the replication 1,
and 2, respectively. The procedure to obtain the adjusted treatment sum of squares
(Cochran and Cox, 1950) in a simple lattice is the following:
2. Let Ba be the adjusted sum of squares for blocks within replication, or SSBAdj
(see Table 4). The adjusted treatment sum of squares, SST rtAdj is calculated
13
by
r
SST rtAdj = SST rtU nadj − k(r − 1)µ[ Bu − Ba ] (17)
(r − 1)(1 + kµ)
Like the adjusted mean square error in balanced designs, the “effective error
0
mean square”, or Ee , is defined as
0 rkµ
Ee = Ee [1 + ]. (18)
k+1
The effective error mean square is used for estimating the gain in accuracy over
randomized blocks. However, the F-statistic for testing the treatment effect
uses the intra block mean square as the denominator.
M ST rtAdj
F = (19)
Ee
The formula for the error variance of the difference between two treatment means
in the same block is the same as those in for a balanced lattice design which is
2Ee [1+(r −1)µ]/r. Because of the partial balance, the error variance of the difference
between two treatment means in the same block is slightly smaller than the error
variance of the difference between two treatment means in different blocks which is
2Ee
[1 + rµ]. (20)
r
Except for small designs, we can use the average variance given by
2Ee rµk
1+ . (21)
r k+1
To estimate the gain in accuracy over the randomized block designs, the effective
error mean square is used to compare with the error mean square in randomized
block analysis.
14
3 NUMERICAL EXAMPLES
3.1 Example of a balanced square lattice design
In the following example, the original data appeared in a paper by Comstock et al
(1948). They studied the effects of nine feeding treatments on the growth rates of
pigs. The experimental unit in this study was a pair of pigs which were fed in the
same pen. The 3 × 3 balanced lattice design is used, so six pigs were required for each
block. From past experience, the litter has an effect on the variance in the growth
rate; hence, two sets of three uniform littermates were assigned to each block. Within
a block, each treatment was applied to only one member of each set. The response
variable is the sum of gains in weight for 2 pigs. The data is given in Table 5. In this
example, we have r = k + 1 = 4 replications, block size of k = 3, k 2 =32 treatments,
and 32 − 1 = 8 blocks.
The total sum of squares, the unadjusted treatment sum of squares, the unadjusted
block sum of squares, and the replication sum of squares are computed below:
from equation (1), SST = (2.202 + 1.842 + . . . + 1.432 ) − CF = 97.55 − 91.58 = 5.97;
15
Table 7: Analysis of Variance for the balanced square lattice design example
To test for a treatment effect, the adjustment factor for treatment means is calculated
as follows:
1.42
Eb = M SBAdj = = 0.178
32 − 1
1.24
Ee = M SE = = 0.078.
(32 − 1)(3 − 1)
From equation (8), we can calculate the adjustment factor,
Eb − Ee 0.178 − 0.078
µ= 2
= = 0.062.
k Eb 32 (0.178)
0
So, using the adjustment factor to calculate the adjusted treatment total, Tj =
Tj + µWj , j = 1, 2, . . . , 9; all adjusted treatment totals are summarized in Table
8.
0
and the effective error mean squares, equation (9), is Ee = Ee (1 + kµ) = Ee [1 +
(r − 1)µ] = 0.078[1 + 3(0.062)] = 0.092. The adjusted treatment mean square which
equals to SST rtAdj /(k 2 − 1) = 3.16/8 = 0.395. Therefore, the F-ratio equals to
0.395/0.092 = 4.30 having 8 and 16 degrees of freedom. Normally, the intra-error
mean square is the denominator of F-statistic, but in this example the effective mean
square is used instead to take account of sampling errors. The standard error of the
p p
adjusted treatment mean is Ee0 /r = 0.092/4 = 0.151; and the standard error
of the difference between 2 adjusted means in the same block (see equation (11)) is
p 0 p
2Ee /r = (2 × 0.092)/4 = 0.215.
The randomized complete block design error sum of squares is SSBAdj + SSE =
1.42 + 1.24 = 2.66 with 24 degrees of freedom. So, the unbiased estimate of error
variance for a randomized block design is 2.66/24, or 0.1108, and the efficiency of the
experiment relative to a randomized complete block design is 0.1108/0.092, or 120%.
P
(which is in replication 1) C2 = Tj(2) − rB2 = (T6 + T7 + T8 + T9 + T10 ) −2(61) =
| {z }
see T able 10
(29 + 23 + 16 + 23 + 23) − 2(61) = −8. Other Cl ’s, l = 1, 2, . . . , 10 are computed in
the same way. The complete set of values of Cl ’s are in Table 11.
C1 C2 C3 C4 C5 C6 C7 C8 C9 C10
61 -8 48 -15 17 -9 -23 -8 -32 -31
From the equation (12), the adjusted block sum of squares is calculated:
Prk 2 Pallrep
l=1 Cl (RCi )2
SSBAdj = − i=12
rk(r − 1) rk (r − 1)
To get the adjusted treatment total, the adjustment factor, equation (14), is
calculated:
Eb − Ee 62.73 − 13.66
µ= = = 0.1564.
k(r − 1)Eb 5(2 − 1)62.73
After getting the the adjustment factor, this quantity is used for calculating the
adjusted treatment total (see equation (15)). For example, the adjusted treatment
total 2, treatment 2 are in the blocks 1 and 7 in replications 1 and 2 , respectively.
So,
0
T2 = T2 + µ[ C1∗ + C2∗ ] = 28
|{z} +0.1564[61 + (−23)] = 33.945.
|{z} |{z} | {z }
in block 1 in block 7 f rom T able 10 see T able 11
20
Another example for treatment 23 which are in the blocks 5 and 8 in replications 1
and 2 , respectively. So,
0
T23 = T23 + µ[ C1∗ + C2∗ ] = 23
|{z} +0.1564[17 + (−8)] = 24.41.
|{z} |{z} | {z }
in block 5 in block 8 f rom T able 10 see T able 11
0
The complete set of values of Tj ’s are in Table 13.
To test the treatment effect, we need the adjusted treatment sum of squares, equation
(17). Equations (16) and (17) would be used to obtain SST rtAdj . First, calculate the
unadjusted sum of squares for blocks within replication:
Bl2
P P 2
Bl
Bu = ( − CF1 ) + ( − CF2 )
| k {z } | k {z }
replication 1 replication 2
322 + 612 + 542 + 742 + 682 2892 802 + 802 + 562 + 892 + 872 3922
=[ − ]+[ − ]
5 25 5 25
Next, calculate the adjusted treatment sum of squares (equation (17)) in the following:
r
SST rtAdj = SST rtU nAdj − k(r − 1)µ[ Bu − Ba ]
(r − 1)(1 + kµ)
2
= 559.28 − 5(2 − 1)(0.1564)[ (350) − 501.84]
(2 − 1)(1 + 5(0.1564))
0 rkµ 2(5)(0.1564)
Ee = Ee [1 + ] = 13.66[1 + ] = 17.2144.
k+1 5+1
Therefore, the F-ratio equals to M ST rtAdj /Ee = (644.54/24)/13.66 = 1.966
having 24 and 8 degrees of freedom. The standard error of the adjusted
p 0 p
treatment mean is Ee /r = 17.2144/2 = 2.933; and the standard error of the
p
difference between 2 adjusted means in the same block is 2Ee [1 + (r − 1)µ]/r =
p √
2(13.66)[1 + (2 − 1)(0.1564)]/2 = 15.796 = 3.975; the standard error of the
difference between two adjusted treatment means in different blocks (equation (20))
is r
2Ee 2(13.66)
(1 + rµ) = (1 + 2(0.1564)) = 4.235.
r 2
The average of variance, equation (21), is
In R Package “agricolae”, although there is no function that can directly analyze data
obtained from a lattice design, there are 2 useful functions for use with lattice designs.
The function “design.lattic” can randomize treatments into a k×k lattice, but only for
a partially balanced lattice design (simple and triple lattice designs). This function,
however, does not generate the analysis of variance. The function “PBIB.test” which
is aimed at the analysis of the partially balanced incomplete block design (PBIB) can
be applied to resoluble designs (lattice and alpha designs). For the previous example
of the study of the effects of nine feeding treatments on the growth rates of pigs by
Comstock et al (1948), the data in Table 5 must be structured in an appropriate form
for use in R. Variables referring to replications, blocks, treatments, response values
must be created. Sample R code is given below:
First, we have to load packages “agricolae” and MASS”. Package “MASS” is also
required because package “agricolae” needs a function “ginv” from the MASS package.
library(agricolae)
library(MASS)
Second, create column vectors for the replication, the block, treatment, and response
which are the argument of the function “PBIB.test”. In Table 5, we have 4
replications, 12 blocks, and 9 treatments.
1.19,1.20,1.15,2.26,1.07,1.45,2.12,2.03,1.63,
2.04,0.93,1.78,1.50,1.60,1.42,1.77,1.57,1.43)
Now, specify the value of k , the block size. For this example, k = 3.
model<- PBIB.test(block,trt,rep,gain.wt,k=3)
After running the above program and display “data”, the following output is
generated:
ANALYSIS PBIB: gain.wt
Number of observations: 36
Analysis of Variance Table
Response: gain.wt
Df Sum Sq Mean Sq F value Pr(>F)
replication 3 0.0774 0.02580 0.3337 0.801132
trt.unadj 8 3.2261 0.40326 5.2168 0.002467 **
replication:block.adj 8 1.4206 0.17758 2.2972 0.074630 .
Residuals 16 1.2368 0.07730
---
Signif. codes: 0 ’***’ 0.001 ’**’ 0.01 ’*’ 0.05 ’.’ 0.1 ’ ’ 1
Treatments
Parameters PBIB
treatmeans : 9
Block size : 3
Blocks/rep : 3
Replication: 4
model$means
<<< to see the objects: comparison and means >>>
trt means mean.adj N std.err
1 1.7425 1.8035178 4 0.1554838
2 1.8400 1.7543554 4 0.1554838
3 2.0125 1.9643445 4 0.1554838
4 1.6050 1.7267220 4 0.1554838
5 1.0025 0.9392861 4 0.1554838
6 1.9050 1.8447665 4 0.1554838
7 1.3650 1.3869601 4 0.1554838
8 1.4025 1.4346559 4 0.1554838
9 1.4800 1.5003916 4 0.1554838
p p
The standard error above does not exactly corresponds to the Ee0 /r = 0.092/4 =
0.151. We can ask “PBIB.test” to show the difference between 2 adjusted mean in
the same block. This follows from equation (11) as well as the previous example.
model$comparison
Comparison between treatments means
<<< to see the objects: comparison and means >>>
The P-values are based on a t statistic. For example, for comparing treatments 1 and
2, t = 0.049/0.214 = 0.229 with an associated P-value of 2P (t16 > 0.229) = 0.821.
The LATTICE procedure in SAS can analyze data from balanced square lattices,
partially balanced square lattices, and some rectangular lattices. The LATTICE
procedure determines the type of lattice design from the data set. It also checks
whether the data is valid and gives the message if it is not working. The data
that we will create must consist of variables named “Group”, “Block”, “Treatmnt”,
and “Rep”. The variable Group indicates which orthogonal replication in the basic
plan (balanced design) includes the experimental unit. The values of ”Group” are
1, 2, . . . , r where r is the number of replicates for a balanced design. The variable
“Rep” is needed when there are more than 1 repetition of the entire basic plan. The
values of “Rep” are 1, 2, . . . , p, where p is the number of replications of the entire basic
plan. Hence, the experiment has a total of r × p replications. Then, for a balanced
square lattice design, there will be a variable “Rep”. More details are in SAS/STAT
9.2 (2008). A sample program for the pig data example is given below.
First, create a dataset with variables Group, Treatmnt, Rep, and response Weight.
data pigs;
input Group Block Treatmnt Weight @@;
cards
1 1 1 2.20 1 1 2 1.84 1 1 3 2.18 1 2 4 2.05
1 2 5 0.85 1 2 6 1.86 1 3 7 0.73 1 3 8 1.60
1 3 9 1.76 2 1 1 1.19 2 1 4 1.20 2 1 7 1.15
2 2 2 2.26 2 2 5 1.07 2 2 8 1.45 2 3 3 2.12
26
Sum of Mean
Source DF Squares Square
Adjusted Treatment
Means for Weight
Treatment Mean
1 1.8035
2 1.7544
3 1.9643
4 1.7267
5 0.9393
27
6 1.8448
7 1.3870
8 1.4347
9 1.5004
The mean sums of squares are the same as those from function PBIB.test in R except
that PROC LATTICE did not perform the F tests. PROC LATTICE also gives the
randomized complete block error, the pooled sums of squares for blocks and intra-
block error. The relative efficiency of the lattice design was 120.5. However, both
SAS and R did not give the adjusted treatment sum of squares. Therefore, we cannot
obtain the test of treatment effect from both R and SAS.
We use the same function as we did for a balanced lattice design. Column vectors
are created for the replication, the block, treatment, and response which are the
arguments of the function “PBIB.test”. The example in Table 9 has 2 replications,
10 blocks, and 25 treatments.
library(agricolae)
library(MASS)
rep<-rep(1:2,each=25)
block<-rep(1:10,each=5)
trt<-c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,1,6,11,16,21,2,7,12,17,22,3,8,13,18,23,
4,9,14,19,24,5,10,15,20,25)
yield<-c(6,7,5,8,6,16,12,12,13,8,17,7,7,9,14,18,16,13,13,14,14,15,
11,14,14,24,13,24,11,8,21,11,14,11,23,16,4,12,12,12,17,10,
30,9,23,15,15,22,16,19)
PBIB.test(block,trt,rep,yield,k=5)
Response: yield
Df Sum Sq Mean Sq F value Pr(>F)
replication 1 212.18 212.180 15.5386 0.001166 **
trt.unadj 24 559.28 23.303 1.7066 0.135789
replication:block.adj 8 501.84 62.730 4.5939 0.004629 **
Residuals 16 218.48 13.655
---
Signif. codes: 0 ’***’ 0.001 ’**’ 0.01 ’*’ 0.05 ’.’ 0.1 ’ ’ 1
Treatments
Parameters PBIB
treatmeans : 25
Block size : 5
Blocks/rep : 5
Replication: 2
Efficiency factor 0.75
All mean squares are the same as those in Table 12 except for the F statistics.
Again, the estimates of adjusted treatment means which are obtained by dividing
the adjusted treatment totals (in Table 13) by 2 (the number of replications) are
p
given below. The standard error below is not exactly the same as Ee0 /r = 2.933.
PBIB.test(block,trt,rep,yield,k=5)$means
Comparison between treatments means
PBIB.test(block,trt,rep,yield,k=5)$comparison[1:24,]
The following SAS code is similar to the code used for a balanced design:
data Soy;
do Group = 1 to 2;
do Block = 1 to 5;
do Plot = 1 to 5;
input Treatmnt Yield @@;output;
end;
end;
end;
cards;
1 6 2 7 3 5 4 8 5 6
6 16 7 12 8 12 9 13 10 8
11 17 12 7 13 7 14 9 15 14
16 18 17 16 18 13 19 13 20 14
21 14 22 15 23 11 24 14 25 14
1 24 6 13 11 24 16 11 21 8
2 21 7 11 12 14 17 11 22 23
3 16 8 4 13 12 18 12 23 12
4 17 9 10 14 30 19 9 24 23
5 15 10 15 15 22 20 16 25 19
;
proc lattice data=Soy;
run;
Sum of Mean
Source DF Squares Square
The mean sums of squares are the same as those in Table 12 as well as the results
from R. PROC LATTICE provides the variances of the mean differences in the same
block and in different blocks. Their square roots are equal to standard errors in R
output. Unlike the PBIB.test in R, PROC LATTICE also gives the average variance
corresponding to formula (21). The following results are the estimates of adjusted
treatment means.
Adjusted Treatment
Means for Yield
Treatment Mean
1 19.0681
2 16.9728
3 14.6463
4 14.7687
5 12.8470
6 13.1701
7 9.0748
8 6.7483
9 8.3707
10 8.4489
11 23.5511
12 12.4558
13 12.6293
14 20.7517
15 19.3299
16 12.6224
17 10.5272
18 10.7007
19 7.3231
20 11.4013
21 11.6259
22 18.5306
23 12.2041
24 17.3265
25 15.4048
32
> lattice.design(block,trt,rep,y,3)
> lattice.design(block,trt,rep,y,5)
The class of the lattice.balance is the list. In this object, the sums of squares, their
degrees of freedom, and the adjusted treatment means can be extracted. The function
“names” gives all objects in the “lattice.balance”.
34
for(i in 1:NumOfTrt){
SumVec<-rep(0,(NumOfBlock*k))
dat<-as.data.frame(cbind(BTotal.long,trt,block,SumVec))
Bj[i]<-sum(ifelse(dat$trt==i,dat$SumVec<- dat$BTotal.long,dat$SumVec<- 0))
}
##############################################
FindW<-as.data.frame(cbind(Tj,Bj))
FindW$W<- k*FindW$V1-(k+1)*FindW$V2+sum(y)
FindW$WSquare<-(FindW$W)^2
SSB.Adj<-sum(FindW$WSquare)/((k^3)*(k+1))
#############################################
MSB.Adj<-SSB.Adj/(max(trt)-1)
SSRep<- anova(lm(y~factor(rep)))$"Sum Sq"[1]
MSRep<- SSRep/(max(rep)-1)
SSTrt.UnAdj<- anova(lm(y~factor(trt)))$"Sum Sq"[1]
MSTrt.UnAdj<- SSTrt.UnAdj/(max(trt)-1)
SSTotal<- sum(anova(lm(y~factor(trt)))$"Sum Sq")
SSE<- SSTotal-SSRep-SSTrt.UnAdj-SSB.Adj
MSE<- SSE/((max(trt)-1)*(sqrt(max(trt))-1))
mu<- (MSB.Adj-MSE)/(max(trt)*MSB.Adj)
CF<- (sum(y))^2/length(rep)
Adj.Total<-FindW$V1+mu*FindW$W
Adj.Trt.Mean<- Adj.Total/(k+1)
SSTrt.Adj<- sum(Adj.Total^2)/max(rep)-CF
MSTrt.Adj <- SSTrt.Adj/(max(trt)-1)
RBD.MSE<-(SSB.Adj+SSE)/((max(trt)-1)+(max(trt)-1)*(sqrt(max(trt))-1))
EffectiveMSE2<-MSE*(1+sqrt(max(trt))*mu)
EffectiveSSE2<-EffectiveMSE2*(k^2-1)*(k-1)
Efficiency<- (RBD.MSE/EffectiveMSE2)*100
F.Trt <- MSTrt.Adj/EffectiveMSE2
pval<-pf(F.Trt, df1=max(trt)-1, df2=(max(trt)-1)*(sqrt(max(trt))-1),lower.tail = FALSE)
se.Adj.trtMean<- sqrt(EffectiveMSE2/(sqrt(max(trt))+1))
se.Diff.same<- sqrt(2*EffectiveMSE2/(sqrt(max(trt))+1))
35
SSBAdj<-SSB.Adj
SSBAdjrep<- max(trt)-1
SSTrt.Adj<-SSTrt.Adj
SSTrt.Adjdf<- max(trt)-1
SSE.Effective<-EffectiveSSE2
Errordf<-(max(trt)-1)*(k-1)
frep<-MSRep/MSE
fb<-MSB.Adj/MSE
pval.B<-pf(fb, df1=max(trt)-1, df2=(max(trt)-1)*(sqrt(max(trt))-1),lower.tail = FALSE)
ftrt<-MSTrt.Adj/EffectiveMSE2
fsse<-1
Fval<-c(frep,fb,ftrt,NA,NA)
Means.Adj<-Adj.Trt.Mean
Pvalue<-c(NA,pval.B,pval,NA,NA)
tmp<-as.data.frame(cbind(rep,block,trt,y))
class(tmp$block)
SSTrt.UnAdj<-anova(lm(y~factor(trt),data=tmp))$"Sum Sq"[1]
SSRep<-anova(lm(y~factor(rep),data=tmp))$"Sum Sq"[1]
SSTot<-anova(lm(y~factor(rep),data=tmp))$"SumSq"[1]+anova(lm(y~factor(rep),
data=tmp))$"Sum Sq"[2]
Total.InBj<- as.matrix(tapply(y,list(block),sum))
Tj<- as.matrix(tapply(y,list(trt),sum))
SumTj.L<-matrix(0,ncol=1,nrow=max(block))
for(i in 1:max(block)){
SumTj.L[i,1] <- sum(Tj[tmp[block==i,][,3]])
}
r<-max(rep)
CL<-SumTj.L-r*Total.InBj
RCi<-matrix(0,ncol=1,nrow=r)
for(j in 1:r){
RCi[j,1]<-sum(CL[unique(tmp[rep==j,][,2])])
}
SSB.Adj<- (sum(CL^2)/(r*k*(r-1)))-(sum(RCi^2)/(r*(k^2)*(r-1)))
SSE<- SSTot-SSRep-SSTrt.UnAdj-SSB.Adj
Df.Rep<- (r-1)
Df.Trt<- k^2-1
Df.Block<- r*(k-1)
Df.Error<- (r*k-k-1)*(k-1)
MSTrt.UnAdj<-SSTrt.UnAdj/Df.Trt
MSRep<-SSRep/Df.Rep
MSB.Adj<-SSB.Adj/Df.Block
37
MSE<-SSE/Df.Error
mu<-(MSB.Adj-MSE)/(k*(r-1)*MSB.Adj)
Adj.Total<-matrix(0,ncol=1,nrow=k^2)
for(i in 1:(k^2)){
Adj.Total[i,1]<- Tj[i]+ mu*sum(CL[tmp[trt==i,][,2]])
}
Adj.means<-Adj.Total/r
BuI<-matrix(0,ncol=1,nrow=r)
for(i in 1:r){
BuI[i,1]<-(sum(Total.InBj[unique(tmp[rep==i,][,2])]^2)/k)-
(sum(Total.InBj[unique(tmp[rep==i,][,2])])^2)/(k^2)
}
Bu<-sum(BuI)
SSTrt.Adj<- SSTrt.UnAdj-k*(r-1)*mu*(r/((r-1)*(1+k*mu))*Bu-SSB.Adj)
F.Trt<- (SSTrt.Adj/Df.Trt)/Effective.Error
se.Adj.Mean<- sqrt(Effective.Error/r)
se.Adj.Mean.Same<- sqrt((2*MSE*(1+(r-1)*mu))/r)
se.Adj.Mean.DiffB<- sqrt((2*MSE*(1+r*mu))/r)
averg.var<- 2*MSE*(1+(r*mu*k)/(k+1))/r
RBD.SSE<-SSB.Adj+SSE
RBD.MSE<- RBD.SSE/(Df.Block+Df.Error)
Efficiency<- (RBD.MSE/Effective.Error)*100
######################################
# MSTrt.UnAdj<-SSTrt.UnAdj/Df.Trt #
# MSRep<-SSRep/Df.Rep #
# MSB.Adj<-SSB.Adj/Df.Block #
# MSE<-SSE/Df.Error #
######################################
Fval<-c(frep,fb,ftrt,NA,NA)
pval.B<-pf(fb, df1= Df.Block, df2= Df.Error,lower.tail = FALSE)
38
Pvalue<-c(NA,pval.B,pval.trt,NA,NA)
print(list(Adj.means=Adj.means))
cat(c(" \n"))
cat(c("S.E.Adjusted Treatment Mean : "),round(se.Adj.Mean,4),"\n")
cat(c("S.E.Diff of Adj Trt Mean : "),round(se.Adj.Mean.Same,4),"\n")
cat(c("S.E.Diff of Adj Trt Mean (not the same bk): "),round(se.Adj.Mean.DiffB,4),"\n")
cat(c("The average variance : "),round(averg.var,4),"\n")
cat(c("Efficiency Relative to RCBD : "),round(Efficiency,4),"\n")
cat(c(" \n"))
cat(c("Analysis of Variance Table: Partially Balanced\n"))
cat(c(" \n"))
return(anovadf)
}
}
#############################################################################
####################### BALANCED LATTICE DESIGN #############################
#############################################################################
# Creates a replication vector
rep<-rep(1:4,each=9)
# Creates a block vector
block<-rep(1:12,each=3)
# Creat a treatment vector
trt<-c(1,2,3,4,5,6,7,8,9,
3,4,8,2,6,7,1,5,9,
1,4,7,2,5,8,3,6,9,
3,5,7,2,4,9,1,6,8)
lattice.design(block,trt,rep,y,3)
#############################################################################
############# PARTIALLY BALANCED LATTICE DESIGN #############################
#############################################################################
rep<-rep(1:2,each=25)
block<-rep(1:10,each=5)
trt<-c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,1,6,11,16,21,2,7,12,17,22,3,8,13,18,23,
39
4,9,14,19,24,5,10,15,20,25)
y<-c(6,7,5,8,6,16,12,12,13,8,17,7,7,9,14,18,16,13,13,14,14,15,
11,14,14,24,13,24,11,8,21,11,14,11,23,16,4,12,12,12,17,10,
30,9,23,15,15,22,16,19)
lattice.balance(block,trt,rep,y,5)
40
B References
References
[1] Bose, R. C., and Nair, K.R.(1939), “Partially Balanced Incomplete Block
Designs,” Sankhya, 4, 337-372.
[2] Cochran, W.G., and Cox, G.M. (1957), Experimental Designs(2nd ed.), New York:
John Wiley & Sons Inc.
[3] Comstock, R.E., Peterson, W.J., and Stewart, H.A. (1948), “An Application of
the Balanced Lattice Design in a Feeding Trial with Swine,” Journal of Animal
Science, 7, 320-331, URL http://jas.fass.org/content/7/3/320.
[4] Federer, W.T., and Wright, J. (1988), “Construction of Lattice Square Designs,”
Biometrical Journal, 30, 77-85.
[6] Fernandez, and George, C.J.(1990), “Analysis of Lattice Designs Using PC-SAS,”
HortScience, 2, 1450.
[7] Groemping U. (2010), “CRAN Task View: Design of Experiments (DoE) and
Analysis of Experimental Data,” HortScience, URL
http://cran.r-project.org/web/views/ExperimentalDesign.html.
URL http://www.iasri.res.in/iasriwebsite/DESIGNOFEXPAPPLICATION
Electronic-Book/Module%202/4LATTICE%20Designs.pdf.
[13] Stroup, W. W., and Paparozzi, E.T. (1989), “Summary, Comments, and
Question and Answer Session,” HortScience, 24, 58-61.
[15] Yates, F. (1936b), “A New Method of Arranging Variety Trials Involving a Large
Number of Varieties”, The Journal of Agricultural Science, 26, 424-455.