oa.design {DoE.base} | R Documentation |
Function for accessing orthogonal arrays
oa.design(ID=NULL, nruns=NULL, nfactors=NULL, nlevels=NULL, factor.names = if (!is.null(nfactors)) { if (nfactors <= 50) Letters[1:nfactors] else paste("F", 1:nfactors, sep = "")} else NULL, columns=NULL, replications=1, repeat.only=FALSE, randomize=TRUE, seed=NULL, min.residual.df=0) origin(ID) oacat oa
ID |
orthogonal array to be used; must be given as the name without quotes
(e.g. L12.2.2.6.1 );
available names can be looked at via oacat$name ;
users can also specify names of their own designs here (cf. details).
ID must be of class oa .
If omitted, ID is automatically determined based on nlevels
or factor.names . |
nruns |
minimum number of runs to be used,
can be omitted if obvious from ID or if
the smallest possible array is to be found |
nfactors |
number of factors;
only needed if nlevels is a single number and
factor.names is omitted;
can otherwise determined from length of factor.names ,
nlevels or column |
nlevels |
number(s) of levels, vector with nfactors entries or single number;
can be omitted, if obvious from factor.names or if ID
and columns are given or if all columns of ID are to be used
with default factor names and levels;
can be a single number if nfactors is known directly or as length of
factor.names |
factor.names |
a character vector of nfactors factor names
or a list with nfactors elements;if the list is named, list names represent factor names, otherwise default factor names are used; the elements of the list are EITHER vectors of appropriate length (corresponding to nlevels )
with factor levels for the respective factorOR empty strings; Default factor names are the first elements of the character vector Letters ,
or the factors position numbers preceded by capital F in case of more than 50 factors.
Default factor levels are the numbers from 1 to the number of levels for each factor. |
columns |
vector of column numbers referring to columns of design ID ;
must not be specified, if ID is omitted;
the entries assign columns of the array to the factors;it may be possible to improve on the properties of the design by using the columns option, since the default column choice is not always ideal! |
replications |
the number of replications of the array,
the setting of repeat.only determines, whether these are real replications
or repeated measurements only. Note that replications are not considered for
accomodation of min.residual.df residual degrees of freedom,
unless a full factorial is used. |
repeat.only |
default FALSE implies real replications,
TRUE implies repeated measurements only |
randomize |
logical indicating whether the run order is to be randomized ? |
seed |
integer seed for the random number generator |
min.residual.df |
minimum number of residual degrees of freedom; Note: function oa.design does not count replications specified with option
replications in determining residual degrees of freedom for min.resid.df . |
Function oa.design
assigns factors to the columns of orthogonal arrays that are
available within package DoE.base or are provided by the user.
The available arrays and their properties are listed in the
data frame oacat
. The design names also indicate the number of runs and the numbers of factors
for each number of levels, e.g. L18.2.1.3.7
is an 18 run design with one factor with
2 levels and seven factors with 3 levels each.
oa
is the S3 class used for orthogonal arrays. Objects of class oa
should at least have
the attribute origin
, an attribute comment
should be used for additional information.
Users can define their own orthogonal arrays and hand them to oa.design
with parameter ID
.
Requirements for the arrays:
oa
and matrix
foo
, you can simply assign it class oa
by
the command class(foo) <- c("oa","matrix")
, see also last example.)
origin
.
comment
; L18.2.1.3.7
that the interaction of the first two factors
can be estimated.
Users are encouraged to send additional arrays to the package maintainer.
The requirements for these are the same as listed above, with attribute origin
being a MUST in this case. (See the last example for how to assign an attribute.)
Currently, package DoE.base contains the orthogonal arrays from Warren Kuhfelds
collection of “parent” arrays only, plus very few additional designs.
It is possible to combine these with each other, or
with Plackett-Burman, full or fractional factorial designs by expansive replacement, as described
by Warren Kuhfeld. The thus-obtainable child arrays have so far not been implemented;
as long as these are not available, function oa.design
will
often suggest larger designs than necessary. The child arrays with up to 143 runs
listed in Warren Kuhfelds technical report will be implemented relatively soon.
For the interim, consider the last example for combining
designs manually. (A lot more than just the child arrays could be obtained from these arrays
by implementing a functionality similar to the market research macros available in SAS; presumably,
this topic will not be addressed soon, as it will involve a substantial amount of work.)
If no specific orthogonal array is specified and function oa.design
does not
find an orthogonal array that meets the specified requirements,
oa.design
returns a full factorial, replicated for enough residual degrees of freedom, if necessary.
If oa.design
has not found an array smaller than the full factorial, it is
absolutely possibly that a smaller array does exist nevertheless. It may be worth
while checking with oacat whether an appropriate smaller array can be found by
combining some of the parent arrays listed there (looking for a design with a few
factors in 5 runs, you may e.g. call oacat[oacat$n5>0,]$name
in order to see the
names of more promising candidate arrays for combination, or you may also want to look
up arrays with n25>0
subsequently.
WARNING: Usually, it is recommended to investigate the properties of a design automatically
created by function oa.design
before starting experimentation.
While all designs can estimate main effects in the absence of interactions,
the presence of interactions may render some designs useless or even dangerous.
Deliberate choice of columns different from the default may improve a design
(an example for this will be added shortly)!
oa.design
returns a data frame of S3 class design
with attributes attached.
In the data frame itself, the experimental factors are all stored as R factors.
For factors with 2 levels, contr.FrF2
contrasts (-1 / +1) are used.
For factors with more than 2 numerical levels, polynomial contrasts are used
(i.e. analyses will per default use orthogonal polynomials).
For factors with more than 2 categorical levels, the default contrasts are used.
Future versions will most likely allow more user control about the type of
contrasts to be used.
The desnum
and run.order
attributes of class design
are
as usual. In the design.info
attribute, the following elements are specific for
this type of designs:
type |
is oa (unless no special orthogonal array is found, in which case
a full factorial is created instead, cf. fac.design for its design.info attribute), |
nlevels |
vector containing the number of levels for each factor |
generating.oa |
contains information on the generating orthogonal array, |
selected.columns |
contains information, which column of the orthogonal array underlies which factor, |
origin |
contains the respective attribute of the orthogonal array, |
comment |
contains the respective attribute of the orthogonal array, |
residual.df |
contains the requested residual degrees of freedom for a main effects model. |
Other information is generic, like documented for class design
.
Function origin
returns the origin attribute of the orthogonal array ID
,
functions comment
and "comment<-"
from package base
return and set the comment attribute.
This package is currently under intensive development. Substantial changes are to be expected in the near future.
Ulrike Groemping
Hedayat, A.S., Sloane, N.J.A. and Stufken, J. (1999) Orthogonal Arrays: Theory and Applications, Springer, New York.
Kuhfeld, W. (2009). Orthogonal arrays. Website courtesy of SAS Institute http://support.sas.com/techsup/technote/ts723.html.
See Also FrF2
, fac.design
, pb
## smallest available array for 6 factors with 3 levels each oa.design(nfactors=6,nlevels=3) ## level combination for which only a full factorial is (currently) found oa.design(nlevels=c(4,3,3,2)) ## array requested via factor.names oa.design(factor.names=list(one=c("a","b","c"), two=c(125,275), three=c("old","new"), four=c(-1,1), five=c("min","medium","max"))) ## array requested via character factor.names and nlevels (with a little German lesson for one two three four five) oa.design(factor.names=c("eins","zwei","drei","vier","fuenf"),nlevels=c(2,2,2,3,7)) ## array requested via explicit name, Taguchi L18 oa.design(ID=L18) ## array requested via explicit name, with column selection oa.design(ID=L18.3.6.6.1,columns=c(2,3,7)) ## array requested with nruns, not very reasonable oa.design(nruns=12, nfactors=3, nlevels=2) ## array requested with min.residual.df oa.design(nfactors=3, nlevels=2, min.residual.df=12) ## The last example: ## generate an orthogonal array equivalent to Taguchi's L54.2.1.3.25 array ## (which is not currently included) up to swaps of levels within a factor ## for some of the factors J to a (i.e. factors 9 to 26) ## by combining L54.3.18.18.1 with L18.2.1.3.7 ## look at catalogued designs for checking possibilities first ## assign class such that design is usable in function oa.design ## assign attributes for documentation purpose oacat[oacat$nruns==54,]$name ##L54.3.18.18.1 looks most promising oacat[oacat$nruns==18,]$name ##L18.2.1.3.7 will deliver one 2-level and 25 3-level factors ##(it can itself be generated from L18.3.6.6.1 by nesting L6.2.1.3.1) parent.des <- oa.design(ID=L54.3.18.18.1, nlevels=c(rep(3,18),18),factor.names=c(Letters[9:26],"comb")) nest.des <- oa.design(ID=L18.2.1.3.7) L54.2.1.3.25 <- cbind(nest.des[parent.des$comb,], parent.des)[-27] rownames(L54.2.1.3.25) <- rownames(parent.des) L54.2.1.3.25[ord(L54.2.1.3.25),] ## look at sorted array ## prepare for using it with function oa.design ## (ordering it is not necessary, just **tidy**) L54.2.1.3.25 <- as.matrix(L54.2.1.3.25[ord(L54.2.1.3.25),]) class(L54.2.1.3.25) <- c("oa", "matrix") attr(L54.2.1.3.25, "origin") <- "L54.3.18.18.1, 18.1 -> L18.2.1.3.7" comment(L54.2.1.3.25) <- comment(L18.2.1.3.7) ## uses comment function from package base origin(L54.2.1.3.25) comment(L54.2.1.3.25) ## can now be used in oa.design, like the built-in arrays oa.design(ID=L54.2.1.3.25,nfactors=22,nlevels=3)