1\name{FrF2-package}
2\alias{FrF2-package}
3\docType{package}
4\title{
5Fractional Factorial designs with 2-level factors
6}
7\description{
8This package creates regular and non-regular Fractional Factorial 2-level designs.
9Furthermore, analysis tools for Fractional Factorial designs with 2-level factors
10are offered (main effects and interaction plots for all factors simultaneously,
11cube plot for looking at the simultaneous effects of three factors, full or half normal plot,
12alias structure in a more readable format than with the built-in function alias).
13
14The package works together with packages DoE.base and DoE.wrapper.
15}
16\details{
17The package is still subject to development; most key functionality is now included.
18Please contact me, if you have suggestions.
19
20This package designs and analyses Fractional Factorial experiments with 2-level factors.
21Regular (function \code{\link{FrF2}}) and non-regular (function \code{\link{pb}}) 2-level fractional factorial
22designs can be generated.
23Function \code{\link{FrF2}}) can generate regular fractional factorials as blocked or split-plot designs, and hard-to-change
24factors can be specified in order to keep the number of level changes low.
25Regular resolution V designs larger than those obtainable from function \code{FrF2}
26can be created by function \code{\link{FrF2Large}} (these are not guaranteed to be optimal).
27Analysis facilities work for completely aliased designs only,
28i.e. e.g. not for analysing Plackett-Burman designs with interactions.
29
30Functions \code{fac.design}, \code{fractionate} or \code{oa.design} from
31Chambers and Hastie (1993) have been used as role models e.g. for
32the option \code{factor.names} or for outputting a data frame with attributes.
33However, S compatibility has not been considered in devising this package. The original
34abovementioned functions are not available in \code{R}; similar
35functions have been from package \pkg{\link[DoE.base:DoE.base-package]{DoE.base}} are
36available together with other general functionality for experimental designs.
37
38In terms of analysis, package \code{FrF2} works on linear models and enables convenient main effects and
39interaction plots (functions \code{MEPlot} and \code{IAPlot}) similar to those
40offered by Minitab software for all factors simultaneously, even though especially the
41interactions are often aliased, i.e. the model is typically singular.
42For the (less frequent) case of suspected three-factor-interactions, function
43\code{cubePlot} displays a cube with corners labeled with the (modeled)
44means of three factors simultaneously.
45Furthermore, the function \code{DanielPlot} from package \pkg{BsMD} has been
46modified to automatically label effects significant according to the
47Lenth-criterion, and to provide more usage comfort to the analyst.
48Finally, the function \code{aliases} determines the alias structure of a
49Fractional Factorial 2-level design in a format more suitable for human readers
50than the output from the built-in function \code{alias}.
51
52}
53\author{
54Ulrike Groemping
55
56Maintainer: Ulrike Groemping <groemping@bht-berlin.de>
57}
58\references{
59    Box G. E. P, Hunter, W. C. and Hunter, J. S. (2005)
60    \emph{Statistics for Experimenters, 2nd edition}.
61    New York: Wiley.
62
63    Chambers, J.M. and Hastie, T.J. (1993). \emph{Statistical Models in S},
64    Chapman and Hall, London.
65
66    Chen, J., Sun, D.X. and Wu, C.F.J. (1993)
67    A catalogue of 2-level and 3-level orthogonal arrays.
68    \emph{International Statistical Review} \bold{61}, 131-145.
69
70    Daniel, C. (1959)
71    Use of Half Normal Plots in Interpreting Two Level Experiments.
72    \emph{Technometrics}, \bold{1}, 311-340.
73
74    Groemping, U. (2014). {R} Package {FrF2} for Creating and Analyzing Fractional
75    Factorial 2-Level Designs. \emph{Journal of Statistical Software}, \bold{56},
76    Issue 1, 1-56. \url{http://www.jstatsoft.org/v56/i01/}.
77
78    Hedayat, A.S., Sloane, N.J.A. and Stufken, J. (1999)
79    \emph{Orthogonal Arrays: Theory and Applications}, Springer, New York.
80
81    Lenth, R.V. (1989) Quick and easy analysis of unreplicated factorials.
82    \emph{Technometrics}, \bold{31}, 469-473.
83
84    Mee, R. (2009). \emph{A Comprehensive Guide to Factorial Two-Level Experimentation}.
85    New York: Springer.
86
87    Montgomery, D.C. (2001). Design and Analysis of Experiments (5th ed.). Wiley, New York.
88
89    Plackett, R.L.; Burman, J.P. (1946) The design of optimum multifactorial
90     experiments. \emph{Biometrika} \bold{33}, 305-325.
91
92    Ryan, K.J. and Bulutoglu, D.A. (2010). Minimum Aberration Fractional Factorial Designs With Large N.
93      \emph{Technometrics} \bold{52}, 250-255.
94
95    Sanchez, S.M. and Sanchez, P.J. (2005). Very Large Fractional Factorial
96     and Central Composite Designs.
97     \emph{ACM Transactions on Modeling and Computer Simulation}
98     \bold{15}, 362-377.
99}
100\keyword{ array }
101\keyword{ design }
102\seealso{
103The key design generating functions: \code{\link{FrF2}}, \code{\link{pb}}, \code{\link{FrF2Large}}\cr
104S3 class \code{\link[DoE.base:class-design]{design}}\cr
105Related packages:
106\code{\link[DoE.base:DoE.base-package]{DoE.base}},
107\code{\link[DoE.wrapper:DoE.wrapper-package]{DoE.wrapper}},
108\code{\link[BsMD:BsMD-package]{BsMD}};\cr
109Graphical analysis functions: \code{\link{MEPlot}}, \code{\link{IAPlot}}, \code{\link{cubePlot}},
110\code{\link{DanielPlot}}\cr
111Analysis of alias structure for linear models of \code{FrF2} designs: \code{\link{aliases}}\cr
112}
113\examples{
114    ### for examples on design generation, cf. functions pb and FrF2
115
116    ### Injection Molding Experiment. Box et al. 1978.
117    data(BM93.e3.data, package="BsMD")  #from BsMD
118    iMdat <- BM93.e3.data[1:16,2:10]  #only original experiment
119    # make data more user-friendly
120    colnames(iMdat) <- c("MoldTemp","Moisture","HoldPress","CavityThick","BoostPress",
121             "CycleTime","GateSize","ScrewSpeed", "y")
122    # linear model with all main effects and 2-factor interactions
123    iM.lm <- lm(y ~ (.)^2, data = iMdat)
124    # determine aliases
125    aliases(iM.lm)
126    # coded version
127    aliases(iM.lm, code=TRUE)
128    # normal plot of effects, default is autolabel with alpha=0.05
129    DanielPlot(iM.lm)
130    DanielPlot(iM.lm,code=TRUE)
131    DanielPlot(iM.lm,code=TRUE,alpha=0.5)
132    # half normal plot of effects
133    DanielPlot(iM.lm,code=TRUE,alpha=0.5,half=TRUE)
134    # main effects plots
135    MEPlot(iM.lm)
136    # interaction plots
137    IAPlot(iM.lm)
138    # interaction plots with attention drawn to aliases
139    aus <- IAPlot(iM.lm, show.alias=TRUE)
140    # alias groups corresponding to interaction plots
141    aliases(iM.lm)$aliases[9:15]
142    # returned object
143    aus
144    # cube plot of three factors
145    # (not very useful for this model, for demonstration only)
146      ## per default, modeled means are shown
147      ## this does not make a difference here, since the main effect of
148      ## ScrewSpeed is confounded with the MoldTemp:HoldPress:BoostPress
149      ## interaction, so that the three-factor-interaction is indirectly included
150      ## in the modeled means
151      cubePlot(iM.lm, "MoldTemp", "HoldPress", "BoostPress")
152      ## modeled means without a three-factor interaction
153      cubePlot(lm(y ~ (MoldTemp+HoldPress+BoostPress)^2, data = iMdat),
154         "MoldTemp", "HoldPress", "BoostPress")
155      ## modeled=FALSE reverts to showing the apparent three-factor interaction
156      cubePlot(lm(y ~ (MoldTemp+HoldPress+BoostPress)^2, data = iMdat),
157         "MoldTemp", "HoldPress", "BoostPress", modeled=FALSE)
158      ## cubePlot also works on raw data
159      cubePlot(iMdat$y, iMdat$MoldTemp, iMdat$HoldPress, iMdat$BoostPress)
160    ## plotting functions also work directly on designs,
161    ## if these have been generated from functions FrF2 or pb:
162      plan <- FrF2(16, 7)
163      plan <- add.response(plan, rnorm(16))
164      MEPlot(plan)
165      IAPlot(plan)
166      DanielPlot(plan)
167
168}
169