# NOT RUN {
## maximum resolution minimum aberration design with 4 factors in 8 runs
FrF2(8,4)
## the design with changed default level codes
FrF2(8,4, default.level=c("current","new"))
## the design with number of factors specified via factor names
## (standard level codes)
FrF2(8,factor.names=list(temp="",press="",material="",state=""))
## the design with changed factor names and factor-specific level codes
FrF2(8,4, factor.names=list(temp=c("min","max"),press=c("low","normal"),
material=c("current","new"),state=c("new","aged")))
## a full factorial
FrF2(8,3, factor.names=list(temp=c("min","max"),press=c("low","normal"),
material=c("current","new")))
## a replicated full factorial (implicit by low number of factors)
FrF2(16,3, factor.names=list(temp=c("min","max"),press=c("low","normal"),
material=c("current","new")))
## three ways for custom specification of the same design
FrF2(8, generators = "ABC")
FrF2(8, generators = 7)
FrF2(8, generators = list(c(1,2,3)))
## more than one generator
FrF2(8, generators = c("ABC","BC"))
FrF2(8, generators = c(7,6))
FrF2(8, generators = list(c(1,2,3),c(2,3)))
## alias structure for three generators that differ only by sign
design.info(FrF2(16,generators=c(7,13,15),randomize=FALSE))$aliased
design.info(FrF2(16,generators=c(7,-13,15),randomize=FALSE))$aliased
design.info(FrF2(16,generators=c(-7,-13,-15),randomize=FALSE))$aliased
## finding smallest design with resolution 5 in 7 factors
FrF2(nfactors=7, resolution=5)
## same design, but with 12 center points in 6 positions
FrF2(nfactors=7, resolution=5, ncenter=12, center.distribute=6)
## maximum resolution minimum aberration design with 9 factors in 32 runs
## show design information instead of design itself
design.info(FrF2(32,9))
## maximum number of free 2-factor interactions instead of minimum aberration
## show design information instead of design itself
design.info(FrF2(32,9,MaxC2=TRUE))
## usage of replication
## shows run order instead of design itself
run.order(FrF2(8,4,replication=2,randomize=FALSE))
run.order(FrF2(8,4,replication=2,repeat.only=TRUE,randomize=FALSE))
run.order(FrF2(8,4,replication=2))
run.order(FrF2(8,4,replication=2,repeat.only=TRUE))
# }
# NOT RUN {
## examples below do work, but are repeated in the
## respective method's separate help file and are therefore prevented
## from running twice
########## automatic blocked designs ###################
## from a full factorial ##
FrF2(8,3,blocks=2)
## with replication
run.order(FrF2(8,3,blocks=2,wbreps=2))
run.order(FrF2(8,3,blocks=2,wbreps=2,repeat.only=TRUE))
run.order(FrF2(8,3,blocks=2,bbreps=2))
run.order(FrF2(8,3,blocks=2,bbreps=2,wbreps=2))
## automatic blocked design with fractions
FrF2(16,7,blocks=4,alias.block.2fis=TRUE,factor.names=c("MotorSpeed",
"FeedMode","FeedSizing","MaterialType","Gain","ScreenAngle","ScreenVibLevel"))
## isomorphic non-catalogued design as basis
FrF2(16,gen=c(7,11,14),blocks=4,alias.block.2fis=TRUE)
## FrF2 uses blockpick.big and ignores the generator
FrF2(64,gen=c(7,11,14),blocks=16,alias.block.2fis=TRUE, block.old=TRUE)
## FrF2 uses Godolphin approach
FrF2(64,gen=c(7,11,14),blocks=16,alias.block.2fis=TRUE)
########## manual blocked design ####################
### example that shows why order of blocks is not randomized
### can of course be randomized by user, if appropriate
FrF2(32,9,blocks=c("Day","Shift"),alias.block.2fis=TRUE,
factor.names=list(Day=c("Wednesday","Thursday"), Shift=c("Morning","Afternoon"),
F1="",F2="",F3="",F4="",F5="",F6="",F7=""), default.levels=c("current","new"))
########## blocked design with estimable 2fis ####################
### all interactions of last two factors to be estimable clearly
### in 64 run design with blocks of size 4
### not possible with catalogue entry 9-3.1
FrF2(64, 6, blocks=16, factor.names=Letters[15:20],
estimable=compromise(6,3)$requirement,
alias.block.2fis=TRUE, randomize=FALSE)
FrF2(design="9-3.2", blocks=16, alias.block.2fis=TRUE,
factor.names = list(C1="",C2="",C3="",C4="",C5="",C6="",C7="",
N1=c("low","high"),N2=c("low","high")),
default.levels = c("current","new"),
estimable=compromise(9, 8:9)$requirement)
FrF2(256, 13, blocks=64, alias.block.2fis=TRUE,
factor.names = list(C1="",C2="",C3="",C4="",C5="",C6="",C7="",C8="",
N1=c("low","high")),
default.levels = c("current","new"),
estimable=compromise(13, 1)$requirement)
########## hard to change factors ####################
## example from Bingham and Sitter Technometrics 19999
## MotorSpeed, FeedMode,FeedSizing,MaterialType are hard to change
BS.ex <- FrF2(16,7,hard=4,
factor.names=c("MotorSpeed", "FeedMode","FeedSizing","MaterialType",
"Gain","ScreenAngle","ScreenVibLevel"),
default.levels=c("-","+"),randomize=FALSE)
design.info(BS.ex)
BS.ex
## NOTE: the design has 8 whole plots.
## If randomize=FALSE is used like here, the first hard-to-change factors
## do not always change between whole plots.
## A conscious and honest decision is required whether this is
## acceptable for the situation at hand!
## randomize=TRUE would cause more changes in the first four factors.
########## automatic generation for split plot ##########
## 3 control factors, 5 noise factors, control factors are whole plot factors
## 8 plots desired in a total of 32 runs
## Bingham Sitter 2003
BS.ex2a <- FrF2(32, 8, WPs=8, nfac.WP=3,
factor.names=c(paste("C",1:3,sep=""), paste("N",1:5,sep="")),randomize=TRUE)
## manual generation of this same design
BS.ex2m <- FrF2(32, 8, generators=c("ABD","ACD","BCDE"),WPs=8, WPfacs=c("C1","C2","C3"), nfac.WP=3,
factor.names=c(paste("C",1:3,sep=""),paste("N",1:5,sep="")),randomize=TRUE)
## design with few whole plot factors
## 2 whole plot factors, 7 split plot factors
## 8 whole plots, i.e. one extra WP factor needed
BSS.cheese.exa <- FrF2(32, 9, WPs=8, nfac.WP=2,
factor.names=c("A","B","p","q","r","s","t","u","v"))
design.info(BSS.cheese.exa)
## manual generation of the design used by Bingham, Schoen and Sitter
## note that the generators include a generator for the 10th spplitting factor
## s= ABq, t = Apq, u = ABpr and v = Aqr, splitting factor rho=Apqr
BSS.cheese.exm <- FrF2(32, gen=list(c(1,2,4),c(1,3,4),c(1,2,3,5),c(1,4,5),c(1,3,4,5)),
WPs=8, nfac.WP=3, WPfacs=c(1,2,10),
factor.names=c("A","B","p","q","r","s","t","u","v","rho"))
design.info(BSS.cheese.exm)
########## usage of estimable ###########################
## design with all 2fis of factor A estimable on distinct columns in 16 runs
FrF2(16, nfactors=6, estimable = rbind(rep(1,5),2:6), clear=FALSE)
FrF2(16, nfactors=6, estimable = c("AB","AC","AD","AE","AF"), clear=FALSE)
FrF2(16, nfactors=6, estimable = formula("~A+B+C+D+E+F+A:(B+C+D+E+F)"),
clear=FALSE)
## formula would also accept self-defined factor names
## from factor.names instead of letters A, B, C, ...
## estimable does not need any other input
FrF2(estimable=formula("~(A+B+C)^2+D+E"))
## estimable with factor names
## resolution three must be permitted, as FrF2 first determines that 8 runs
## would be sufficient degrees of freedom to estimate all effects
## and then tries to accomodate the 2fis from the model clear of aliasing in 8 runs
FrF2(estimable=formula("~one+two+three+four+two:three+two:four"),
factor.names=c("one","two","three","four"), res3=TRUE)
## clear=FALSE allows to allocate all effects on distinct columns in the
## 8 run MA resolution IV design
FrF2(estimable=formula("~one+two+three+four+two:three+two:four"),
factor.names=c("one","two","three","four"), clear=FALSE)
## 7 factors instead of 6, but no requirements for factor G
FrF2(16, nfactors=7, estimable = formula("~A+B+C+D+E+F+A:(B+C+D+E+F)"),
clear=FALSE)
## larger design for handling this with all required effects clear
FrF2(32, nfactors=7, estimable = formula("~A+B+C+D+E+F+A:(B+C+D+E+F)"),
clear=TRUE)
## 16 run design for handling this with required 2fis clear, but main effects aliased
## (does not usually make sense)
FrF2(16, nfactors=7, estimable = formula("~A+B+C+D+E+F+A:(B+C+D+E+F)"),
clear=TRUE, res3=TRUE)
# }
# NOT RUN {
## example for the sort option added with version 1.6-1
## and for usage of a catalogue from package FrF2.catlg128 (simplified with version 1.6-5)
# }
# NOT RUN {
estim <- compromise(17,15:17)$requirement ## all interactions of factors 15 to 17 (P,Q,R)
## VF2 algorithm without pre-sorting of vertices
FrF2(128, 17, estimable=estim, select.catlg=catlg128.17) ## very slow,
## interrupt with ESC key
## VF2 algorithm with pre-sorting of vertices
FrF2(128, 17, estimable=estim, sort="high", select.catlg=catlg128.17) ## very fast
FrF2(128, 17, estimable=estim, sort="low", select.catlg=catlg128.17) ## very fast
## LAD algorithm
FrF2(128, 17, estimable=estim, method="LAD", select.catlg=catlg128.17) ## very fast
## guaranteed to be MA clear design
## only works, if package FrF2.catlg128 is installed
# }
# NOT RUN {
## example for necessity of perms, and uses of select.catlg and perm.start
## based on Wu and Chen Example 1
# }
# NOT RUN {
## runs per default about max.time=60 seconds, before throwing error with
## interim results
## results could be used in select.catlg and perm.start for restarting with
## calculation of further possibilities
FrF2(32, nfactors=11, estimable = formula("~(A+B+C+D+E+F)^2"), clear=FALSE)
## would run for a long long time (I have not yet been patient enough)
FrF2(32, nfactors=11, estimable = formula("~(A+B+C+D+E+F)^2"), clear=FALSE,
max.time=Inf)
## can be easily done with perms,
## as only different subsets of six factors are non-isomorphic
perms.6 <- combn(11,6)
perms.full <- matrix(NA,ncol(perms.6),11)
for (i in 1:ncol(perms.6))
perms.full[i,] <- c(perms.6[,i],setdiff(1:11,perms.6[,i]))
FrF2(32, nfactors=11, estimable = formula("~(A+B+C+D+E+F)^2"), clear=FALSE,
perms = perms.full )
# }
Run the code above in your browser using DataLab