Learn R Programming

DoE.base (version 0.5)

oa.design: Function for accessing orthogonal arrays

Description

Function for accessing orthogonal arrays

Usage

oa.design(ID=NULL, nruns=NULL, nfactors=NULL, nlevels=NULL, 
      factor.names = if (!is.null(nfactors)) {
        if (nfactors 

Arguments

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. d
nruns
number of runs, 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 col
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 ar
factor.names
a character vector of nfactors 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)
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
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
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.

Value

  • 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:
  • typeis 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),
  • nlevelsvector containing the number of levels for each factor
  • generating.oacontains information on the generating orthogonal array,
  • selected.columnscontains information, which column of the orthogonal array underlies which factor,
  • originreturns the respective attribute of the orthogonal array,
  • commentreturns the respective attribute of the orthogonal array,
  • residual.dfreturns the requested residual degrees of freedom for a main effects model.
  • Other information is generic, like documented for class design.

Details

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:
  • Factor levels must be coded as numbers from 1 to number of levels.
  • The array must be of classesoaandmatrix (If your array is a matrix namedfoo, you can simply assign it classoaby the commandclass(foo) <- c("oa","matrix"), see also last example.)
  • The array should have an attributeorigin.
  • The array can have an attributecomment; 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.
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.

References

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

See Also FrF2, fac.design, pb

Examples

Run this code
## 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