FrF2 | R Documentation |
Regular fractional factorial 2-level designs are provided. Apart from obtaining the usual minimum aberration designs in a fixed number of runs, it is possible to request highest number of free 2-factor interactions instead of minimum aberration or to request the smallest design that fulfills certain requirements (e.g. resolution V with 8 factors).
FrF2(nruns = NULL, nfactors = NULL, factor.names = if (!is.null(nfactors)) {
if (nfactors <= 50) Letters[1:nfactors] else
paste("F", 1:nfactors, sep = "")} else NULL,
default.levels = c(-1, 1), ncenter=0, center.distribute=NULL,
generators = NULL, design = NULL,
resolution = NULL, select.catlg=catlg,
estimable = NULL, clear = TRUE, method="VF2", sort="natural",
ignore.dom = !isTRUE(all.equal(blocks,1)),
useV = TRUE, firsthit=FALSE, res3 = FALSE, max.time = 60,
perm.start=NULL, perms = NULL,
MaxC2 = FALSE, replications = 1, repeat.only = FALSE,
randomize = TRUE, seed = NULL, alias.info = 2,
blocks = 1, block.name = "Blocks", block.old=FALSE,
force.godolphin=alias.block.2fis,
bbreps=replications, wbreps=1,
alias.block.2fis = FALSE,
hard = NULL, check.hard=10, WPs=1,nfac.WP=0,
WPfacs=NULL, check.WPs = 10, ...)
FrF2.currentlychecked()
nruns |
Number of runs, must be a power of 2 (4 to 4096), if given. The number of runs can also be omitted. In that case,
if If If estimable is specified and |
nfactors |
is the number of 2-level factors to be investigated.
It can be omitted, if it is obvious from If For blocked designs, block generator columns are not included in
For automatically-generated split-plot designs (cf. details section),
|
factor.names |
a character vector of |
default.levels |
default levels (vector of length 2) for all factors for which no specific levels are given |
ncenter |
number of center points per block; |
center.distribute |
the number of positions over which the center points
are to be distributed for each block; if NULL (default), center points are
distributed over end, beginning, and middle (in that order, if there are fewer than three center points)
for randomized designs, and appended to the end for non-randomized designs.
for more detail, see function |
generators |
There are
a list of vectors with position numbers of base factors (e.g. c(1,3,4) stands for the interaction between first, third and fourth base factor) a vector of character representations of these interactions, e.g. “ACD” stands for the same interaction as above a vector of columns numbers in Yates order (e.g. 13 stands for ACD).
Note that the columns 1, 2, 4, 8, etc., i.e. all powers of 2, are reserved
for the base factors and cannot be used for assigning additional factors,
because the design would become a resolution II design. For looking up
which column number stands for which interaction, type e.g.
In all cases, preceding the respective entry with a minus sign
(e.g. -c(1,3,4), “-ACD”, -13) implies that the levels
of the respective column are reversed. |
design |
is a character string specifying the name of a design listed
in the catalogue specified as |
resolution |
is the arabic numeral for the requested resolution of the design.
|
select.catlg |
specifies a catalogue of class If a specific different catalogue of designs is available,
this can be specified here. Names of catalogues from package FrF2.catlg128
can be given here without prior loading of that package; loading of the package
and the selected catalogue will then happen automatically, provided the
package is installed (for version >=1.2 of package FrF2.catlg128;
for earlier versions, the suitable catalogue has to be manually loaded
using the |
estimable |
indicates the 2-factor interactions (2fis) that are to be estimable in
the design. Consult the specific help file (
|
clear |
logical, indicating how estimable is to be used. See |
method |
character string indicating which subgraph isomorphism search routine
of package igraph is used ( |
sort |
character string indicating how the estimability requirement and the
candidate design clear 2fis are handed to
the subgraph isomorphism search routine of package igraph.
The default This option is relevant for |
ignore.dom |
logical, default FALSE for unblocked designs, TRUE for blocked designs;
if TRUE, |
useV |
NULL or logical; relevant for designs with |
firsthit |
logical; relevant for designs with |
res3 |
logical; if TRUE, |
max.time |
maximum time for design search as requested by |
perm.start |
used with |
perms |
used with It is planned to automatically generate perms for certain structures like compromise designs in the (not so near) future. |
MaxC2 |
is a logical and defaults to FALSE. If TRUE,
maximizing the number of clear 2-factor interactions takes precedence
over minimizing aberration. Resolution is always considered first.
|
replications |
positive integer number. Default 1 (i.e. each row just once).
If larger, each design run is executed replication times.
If Otherwise (default), the full experiment is first carried out once, then for the second replication and so forth. In case of randomization, each such blocks is randomized separately. In this case, replication variance is more likely suitable for usage as error variance (unless e.g. the same parts are used for replication runs although build variation is important). |
repeat.only |
logical, relevant only if replications > 1. If TRUE,
replications of each run are grouped together
(repeated measurement rather than true replication). The default is
|
randomize |
logical. If TRUE, the design is randomized. This is the default.
In case of replications, the nature of randomization depends on the setting of
option |
seed |
optional seed for the randomization process |
alias.info |
can be 2 or 3, gives the order of interaction effects for which
alias information is to be included in the |
blocks |
is EITHER
If If the experiment is randomized, randomization happens within blocks.
In case of many blocks, units should also be randomized to blocks wherever possible! For the statistical and algorithmic background of blocked designs, see |
block.name |
name of the block factor, default “Blocks” |
block.old |
logical; if TRUE, blocking behavior of FrF2 version 1.7.2 is activated |
force.godolphin |
logical; if TRUE, blocking is forced to be done with the
Godolphin method (using function |
bbreps |
between block replications; these are always taken as genuine replications,
not repeat runs; default: equal to |
wbreps |
within block replications; whether or not these are taken as genuine replications
depends on the setting of |
alias.block.2fis |
logical indicating whether blocks may be aliased
with 2fis (default: |
hard |
gives the number of hard to change factors. These must be the
first factors in |
check.hard |
is the number of candidate designs from the catalogue specified
in |
WPs |
is the number of whole plots and must be a power of 2. For statistical and algorithmic information on treatment of split-plot designs
see the separate help file |
nfac.WP |
is the number of whole plot factors and must be smaller than The If a design is provided and whole plot factors are manually provided
(design or generators option together with If If |
WPfacs |
is per default NULL. In this case, the first
|
check.WPs |
is the number of potential split-plot designs that are
compared by function |
... |
currently not used |
Per default, the function picks the best design from the
default design catalogue catlg
(a list object of class catlg
).
Alternatively, the user can explicitly specify a design through accessing
a specific catalogued design using the design
option or specifying non-catalogued
generators via the generators
option.
Apart from generation of simple fractional factorial designs based on catalogued
or non-catalogued generators, function FrF2
allows specification of blocked designs
and split-plot designs, as well as specification of a set of 2fis that are required to be estimable.
The implementation of these possibilities is explained in the separate help files block
,
splitplot
and estimable.2fis
. If you consider to use
option hard
, it may also be worth while to look at the splitplot
help file.
Function FrF2
is still under development, although most features are
now included, and the principle structure of inputs and outputs should not change
much any more. Please contact me with any suggestions for improvements.
Function FrF2.currentlychecked
is meant as a diagnostic tool,
when searching for designs with option estimable
and clear=TRUE
. If the search takes very long, it can be interrupted
(CAUTION: in some igraph versions, interrupting the search may crash R).
After a successful interruption, and FrF2.currentlychecked()
returns a character string with the name of the design that was checked at the
time of interruption.
Function FrF2
returns a data frame of S3 class design
that has attached attributes that can be accessed
by functions desnum
,
run.order
and
design.info
.
The data frame itself contains the design with levels coded as requested.
If no center points have been requested, the design columns are factors with
contrasts -1
and +1
(cf. also contr.FrF2
); in case
of center points, the design columns are numeric.
The following attributes are attached to it:
desnum |
Design matrix in -1/1 coding |
run.order |
a three column data frame; |
design.info |
list with the entries
|
Since R version 3.6.0, the behavior of function sample
has changed
(correction of a biased previous behavior that should not be relevant for the randomization of designs).
For reproducing a randomized design that was produced with an earlier R version,
please follow the steps described with the argument seed
.
Ulrike Groemping
Bingham, D.R., Schoen, E.D. and Sitter, R.R. (2004). Designing Fractional Factorial Split-Plot Experiments with Few Whole-Plot Factors. Applied Statistics 53, 325-339.
Bingham, D. and Sitter, R.R. (2003). Fractional Factorial Split-Plot Designs for Robust Parameter Experiments. Technometrics 45, 80-89.
Bisgaard, S. (1994a). Blocking generators for small 2^{k-p}
designs.
J. Quality Technology 26, 288-294.
Chen, J., Sun, D.X. and Wu, C.F.J. (1993) A catalogue of 2-level and 3-level orthogonal arrays. International Statistical Review 61, 131-145.
Cheng, C.-S., Martin, R.J., and Tang, B. (1998). Two-level factorial designs with extreme numbers of level changes. Annals of Statistics 26, 1522-1539.
Cheng, C.-S. and Tsai, P.-W. (2009). Optimal two-level regular fractional factorial block and split-plot designs. Biometrika 96, 83-93.
Cheng, S.W. and Wu, C.F.J. (2002). Choice of optimal blocking schemes in 2-level and 3-level designs. Technometrics 44, 269-277.
Cordella, L.P., Foggia, P., Sansone, C. and Vento, M. (2001). An improved algorithm for matching large graphs. Proc. of the 3rd IAPR TC-15 Workshop on Graphbased Representations in Pattern Recognition, 149–159.
Godolphin, J. (2021). Construction of Blocked Factorial Designs to Estimate Main Effects and Selected Two-Factor Interactions. J. Royal Statistical Society B 83, 5-29. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/rssb.12397")}.
Groemping, U. (2012). Creating clear designs: a graph-based algorithm and a catalogue of clear compromise plans. IIE Transactions 44, 988–1001. Early preprint available at http://www1.bht-berlin.de/FB_II/reports/Report-2010-005.pdf.
Groemping, U. (2014a). R Package FrF2 for Creating and Analyzing Fractional Factorial 2-Level Designs. Journal of Statistical Software, 56, Issue 1, 1-56. https://www.jstatsoft.org/v56/i01/.
Groemping, U. (2014b). A Note on Dominating Fractional Factorial Two-Level Designs With Clear Two-Factor Interactions. Technometrics 56, 42–45.
Groemping, U. (2021). An algorithm for blocking regular fractional factorial 2-level designs with clear two-factor interactions. Computational Statistics and Data Analysis 153, 1-18. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.csda.2020.107059")}. Preprint at Report 3/2019.
Huang, P., Chen, D. and Voelkel, J.O. (1998). Minimum-Aberration Two-Level Split-Plot Designs. Technometrics 40, 314-326.
Mee, R. (2009). A Comprehensive Guide to Factorial Two-Level Experimentation. New York: Springer.
Solnon, C. (2010). AllDifferent-based Filtering for Subgraph Isomorphism. Artificial Intelligence 174, 850–864.
Sun, D.X., Wu, C.F.J. and Chen, Y.Y. (1997).
Optimal blocking schemes for 2^n
and 2^{n-p}
designs. Technometrics 39,
298-307.
Wu, C.F.J. and Chen, Y. (1992) A graph-aided method for planning two-level experiments when certain interactions are important. Technometrics 34, 162-175.
See also
FrF2Large
for regular fractional factorial designs
with more than 4096 runs (these are not supported by a design catalogue, except for
a few resolution V designs which have not been checked for any optimality among the resolution V designs),
pb
for non-regular fractional factorials according
to Plackett-Burman,
catlg
for the underlying design catalogue and some accessor functions,
and block
, splitplot
or estimable.2fis
for statistical and algorithmic information on the respective topic.
## 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, using Godolphin approach
FrF2(16,gen=c(7,11,14),blocks=4,alias.block.2fis=TRUE)
## isomorphic non-catalogued design as basis, not using Godolphin approach
## (different design of comparable quality in this case)
FrF2(16,gen=c(7,11,14),blocks=4,alias.block.2fis=TRUE, force.godolphin=FALSE)
## 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, regardless of force.godolphin argument
## because the setting is large
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)
## End(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
### CAUTION: in some igraph versions, the following may crash R ###
FrF2(128, 17, estimable=estim, select.catlg=catlg128.17)
## very slow, interrupt with ESC key after a short while
## !!! save all important work before, in case R crashes
FrF2.currentlychecked() ## displays the design that was currently checked
## should be 17-10.2407, if the interrupt was successful
## 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
## End(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 )
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.