Description Usage Arguments Details Value Author(s) References Examples
Blocking of experimental designs using various criteria.
1 2 
frml 
This may be omitted if 
withinData 
A matrix or data.frame describing the variables. If the columns are not
named, they will be assumed to have the names X1,X2, etc. Although data may be input as
global variables used in frml, it is preferable to input it here. The number of rows in 
blocksizes 
A vector giving the block sizes for each block. The length of 
rows 
Row numbers (not rownames) of withinData rows to be used as a starting blocked design. 
wholeBlockData 
A matrix or data.frame describing the whole block variables. The number of rows should equal the length of blocksizes. Each row should correspond to the settings of the whole block variable in a block. 
center 
If TRUE, the withinData and wholeBlockData will be centered. 
nRepeats 
The number of times the entire process is repeated. 
criterion 
"D":Dcriterion: "OB","OBS": orthogonal blocks, unscaled and scaled; "Dp","Dpc": Product of block determinants, uncentered and centered. 
args 
If TRUE, the actual arguments to the function including the starting random number seed should be output. 
Cook and Nachtsheim (1989) developed a blocking algorithm using the D criterion, which not only finds blocks, but attempts to optimize the design itself. The package Dopt, converted by V.N. Venables, implements this technology – unfortunately there seem to be bugs in the FORTRAN code.
This function uses various criteria to block either preexisting designs or to creates a new blocked design from a candidate list. There may be interactions between whole plot and within plot factors, and it may be used to produce multistratum blocked designs.
The algebraic expressions used here for the D criterion are quite different than those used by either Cook and Nachtshim or Goos and Vandebroek. They are described in Comments on algorithmic design, a paper accompanying this package.
Although the D criterion produces good designs for all blocks, the allocation for individual blocks can often be improved upon by the use of either the Dp or Dpc criterion, which optimize the product of the determinants of the individual blocks. The Dp criterion uses uncentered blocks, the Dpc uses centered blocks.
Blocking may also be done using the orthogonal blocking procedure of Nguyen. This comes in two flavors OB and OBS which differ in that for OBS, the columns of S are scaled by division with the sample variance of the data, thus deemphasizing squared and other large terms.
Blocking may be done when whole plot factors interact with within plot factors. Split plot experiments are sometimes of this nature. Goos and Vandebroek (2003) developed a procedure for this problem which algorithmically blocks using a candidate list and the ratio between the whole and within variances. Trinca and Gilmour (2001) give an algorithm which does not depend on the ratio of the variances. The present procedure assumes that the whole blocks and their factors, have been decided upon in advance. It makes no assumptions about the ratio between whole and within variances.
A vignette giving further details is availble. To access it, type
vignette("AlgDesign")
D 
det(M)^(1/k), where det(M) is the determinant of the normalized dispersion matrix M – i.e. M=X'X/N, where each row of X has had the appropriate block mean subtracted. 
Dp (Dpc) 
[prod (det(Mi)^(1/k)]^(1/b), where det(Mi) is the determinant of the normalized dispersion matrix for the uncentered (centered) block submatrix of X, and b is the number of blocks. The normalization is with respect to the number of observations in each block. 
diagonality or SS 
The diagonality is (M/P)^{1/k}, where P is the product of the diagonal elements of M. The SS is the sum of squares of S when the OB criterion is used. 
Blocks 
A list of the blocks, labeled B1, B2, etc. 
design 
A data.frame. The design with blocks stacked in order. 
rows 
Numeric row numbers of the design rows corresponding to the withinData rows. 
args 
A list of the actual arguments used in this call. 
Bob Wheeler bwheelerg@gmail.com
Please cite this program as follows:
Wheeler, R.E. (2004). optBlock. AlgDesign. The R project for statistical computing https://www.rproject.org/
Atkinson, A.C. and Donev, A.N. (1989). The construction of exact Doptimum experimental designs with application to blocking response surface designs. Biometrika. 76. 515526.
Cook, R.D. and Nachtsheim, C.J. (1989). Computeraided blocking of factorial and responsesurface designs. Technometrics. 313. 339346.
Goos, P. and Vandebroek, M. (2003). Doptimal splitplot designs with given numbers and sizes of whole plots. Technometrics. 453. 235245.
Nguyen, NamKy. (2001). Cutting experimental designs into blocks. AusNZJSt. 433. 367374.
Trinca, L.A. and Gilmour, S.G. (2000). An algorithm for arranging response surface designs in small blocks. Computational Statistics and Data Analysis. 33. 2543.
Trinca, L.A. and Gilmour, S.G. (2001). Multistratum response surface designs. Technometrics. 431. 2533.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59  # Blocking the design for a quadratic polynomial in three variables into two
# seven trial blocks:
dat<gen.factorial(3,3,varNames=c("A","B","C"))
desD<optFederov(~quad(.),dat,nTrials=14,eval=TRUE) # Choose an optimum 14 trail design.
optBlock(~quad(.),desD$design,c(7,7))
# Letting optBlock() search the dat candidate list instead of first choosing a
# 14 trial design.
optBlock(~quad(.),dat,c(7,7))
# A block design for 7 treatments in 7 blocks of size 3. Note how withinData
# is recycled to fill out the blocksize requirements.
BIB<optBlock(~.,withinData=factor(1:7),blocksizes=rep(3,7))
# This is a balanced incomplete block design as may be seen from:
crossprod(table(BIB$rows,c(rep(1:7, rep(3,7)))))
# A partially balanced incomplete block design with two associate classes:
tr<factor(1:9)
PBIB<optBlock(~.,withinData=tr,blocksizes=rep(3,9))
crossprod(table(PBIB$rows,c(rep(1:9, rep(3,9)))))
# Two fractions of a 2^(41).
dat<gen.factorial(2,4)
od<optBlock(~.,dat,c(8,8))
# The blocks are not themselves orthogonal even though the entire design is optimal.
bk<data.matrix(od$Blocks$B1)
t(bk)%*%bk
# Better blocks may be obtained as follows, but note that they are not generally
# the fractions that would be obtained by confounding the third order interaction.
od<optBlock(~.,dat,c(8,8),criterion="Dpc",nR=10)
bk<data.matrix(od$Blocks$B1)
t(bk)%*%bk
# Blocking with whole plot factors. Note that the 27 rows of within are recycled
# to make the 54 trial blocked design.
within<expand.grid(A=c(1,0,1),B=c(1,0,1),C=c(1,0,1))
whole<expand.grid(D=factor(1:3),E=factor(1:3))
od<optBlock(~D+E*(quad(A,B,C)),withinData=within,blocksizes=rep(6,9),wholeBlockData=whole)
# Either withinData, or wholeBlockData may be an approximate theory optimial design
# produced by optFederov() for nTrials. The first column in the optFederov() output
# design, named "Rep..", is used to replicate the trials.
within<optFederov(~quad(A,B,C),within,nT=54,approx=TRUE)
od<optBlock(~D+E*(quad(A,B,C)),withinData=within$design,blocksizes=rep(6,9),wholeBlockData=whole)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.