oa.design(ID=NULL, nruns=NULL, nfactors=NULL, nlevels=NULL,
factor.names = if (!is.null(nfactors)) {
if (nfactors
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. dID
or if
the smallest possible array is to be foundnlevels
is a single number and
factor.names
is omitted;
can otherwise determined from length of factor.names
,
nlevels
or col
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
arnfactors
factor names
or a named list with nfactors
elements, for which the names represent factor names
and the elements are
EITHER vectors of appropriate length (corresponding to nlevels) ID
;
must not be specified, if ID
is omitted;
the entries assign columns of the array to the factorsrepeat.only
determines, whether these are real replications
or repeated measurements only. Note that replications are not considered for
accomodation of oa.design
does not count replications specified with option
replications
in determining residual degrees of freedom for min.resid.df
.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: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),design
.oa.design
assigns factors to the columns of orthogonal arrays that are
available within package 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 oa.design
with parameter ID
.
Requirements for the arrays:
oa
andmatrix
(If your array is a matrix namedfoo
, you can simply assign it classoa
by
the commandclass(foo) <- c("oa","matrix")
, see also last example.)origin
.comment
;
this should be used for mentioning specific properties, e.g.
for the L18.2.1.3.7 that the interaction of the first two factors
can be estimated.origin
being a MUST in this case. (See the last example for how to assign an attribute.)
Currently, package 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.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"
attr(L54.2.1.3.25, "comment") <- comment(L18.2.1.3.7)
## can now be used in oa.design, like the built-in arrays
oa.design(ID=L54.2.1.3.25,nfactors=22,nlevels=3)
Run the code above in your browser using DataLab