# NOT RUN {
## The number of searches in the following examples have been limited for fast execution.
## In practice, the number of searches may need to be increased for optimum results.
## Designs should be rebuilt several times to check that a near-optimum design has been found.
## Factorial designs defined by a treatments data frame and a factorial model equation.
# Main effects of five 2-level factors in a half-fraction of a 4 x 4 row-and column design.
GF = expand.grid(F1=factor(1:2),F2=factor(1:2),F3=factor(1:2),F4=factor(1:2),F5=factor(1:2))
blocks(treatments=GF,model="~ F1+F2+F3+F4+F5",replicates=.5,rows=4,columns=4,searches=20)
# Quadratic regression for one 6-level numeric factor in 2 randomized blocks
blocks(treatments=expand.grid(X=1:6),model=" ~ poly(X,2)",rows=2,searches=5)
# Second-order model for five qualitative 2-level factors in 4 randomized blocks
GF=expand.grid(F1=factor(1:2),F2=factor(1:2),F3=factor(1:2),F4=factor(1:2),F5=factor(1:2))
blocks(treatments=GF,model=" ~ (F1+F2+F3+F4+F5)*(F1+F2+F3+F4+F5)",rows=4,searches=5)
# First-order model for 1/3rd fraction of four qualitative 3-level factors in 3 blocks
GF=expand.grid(F1=factor(1:3),F2=factor(1:3),F3=factor(1:3),F4=factor(1:3))
blocks(treatments=GF,model=" ~ (F1+F2+F3+F4)",replicates=(1/3),rows=3,searches=5)
# Second-order model for a 1/3rd fraction of five qualitative 3-level factors in 3 blocks
GF=expand.grid( F1=factor(1:3), F2=factor(1:3), F3=factor(1:3), F4=factor(1:3), F5=factor(1:3) )
modelform=" ~ (F1+F2+F3+F4+F5)*(F1+F2+F3+F4+F5)"
blocks(treatments=GF,model=modelform,rows=3,replicates=(1/3),searches=1)
# Second-order model for two qualitative and two quantitative level factors in 4 randomized blocks
GF=expand.grid(F1=factor(1:2),F2=factor(1:3),V1=1:3,V2=1:4)
modelform=" ~ F1 + F2 + poly(V1,2) + poly(V2,2) + (poly(V1,1)+F1+F2):(poly(V2,1)+F1+F2) "
blocks(treatments=GF,model=modelform,rows=4,searches=5)
# Plackett and Burman design for eleven 2-level factors in 12 runs (needs large number of searches)
GF=expand.grid(F1=factor(1:2),F2=factor(1:2),F3=factor(1:2),F4=factor(1:2),F5=factor(1:2),
F6=factor(1:2),F7=factor(1:2),F8=factor(1:2),F9=factor(1:2),F10=factor(1:2),F11=factor(1:2))
# }
# NOT RUN {
blocks(treatments=GF,model="~ F1+F2+F3+F4+F5+F6+F7+F8+F9+F10+F11",replicates=(12/2048))
# }
# NOT RUN {
## Unstructured treatments partitioned into equally replicated treatment sets
# 3 treatments x 2 replicates + 2 treatments x 4 replicates
blocks(treatments=c(3,2),replicates=c(2,4),searches=10)
# 4 treatments x 4 replicates with 2 main rows each containing two complete replicates
blocks(treatments=4,replicates=4,rows=2)
# 50 treatments x 4 replicates with 4 main blocks and 5 nested sub-blocks in each main block
blocks(treatments=50,replicates=4,rows=c(4,5))
# as above but with 20 single replicate treatments giving one extra treatment per sub-block
blocks(treatments=c(50,20),replicates=c(4,1),rows=c(4,5))
# 6 replicates of 6 treatments in 4 blocks of size 9 (non-binary block design)
blocks(treatments=6,replicates=6,rows=4)
# 4 replicates of 13 treatments arranged in a 13 x 4 Youden rectangle
blocks(treatments=13,replicates=4,rows=13,columns=4)
# 64 treatments x 2 replicates with nested 8 x 8 row-and-column designs in two main blocks
blocks(treatments=64,replicates=2,rows=c(2,8),columns=c(1,8),searches=10)
# 64 treatments x 2 replicates with two main blocks and a 4 x 4 row-and-column in each main block
blocks(treatments=64,replicates=2,rows=c(2,4),columns=c(1,4),searches=10)
# 128 treatments x 2 replicates with two main blocks and 3 levels of nesting
# }
# NOT RUN {
blocks(128,2,c(2,2,2,2))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab