Learn R Programming

DoE.base (version 0.5)

fac.design: Function for full factorial designs

Description

Function for creating full factorial designs with arbitrary numbers of levels

Usage

fac.design(nlevels=NULL, nfactors=NULL, factor.names = NULL, 
        replications=1, repeat.only = FALSE, randomize=TRUE, seed=NULL)

Arguments

nlevels
number(s) of levels, vector with nfactors entries or single number; can be omitted, if obvious from factor.names
nfactors
number of factors, can be omitted if obvious from entries nlevels or factor.names
factor.names
if nlevels is given, factor.names can be a character vector of factor names. Otherwise it must be a named list of vectors with factor levels. If both nlevels and factor.names are given, they must
replications
positive integer number. Default 1 (i.e. each row just once). If larger, each design run is executed replication times. If repeat.only, repeated measurements are carried out directly in sequence, i.e. no true replic
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 repeat.only=FALSE, i.e. the complete experiment
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 repeat.only.
seed
optional seed for the randomization process

Value

  • fac.design returns a data frame of S3 class design with attributes attached. 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 design.info attribute of the data frame has the element nlevels in addition to the standard elements documented for class design.

Details

fac.design creates full factorial designs, i.e. the number of runs is the product of all numbers of levels.

References

Hedayat, A.S., Sloane, N.J.A. and Stufken, J. (1999) Orthogonal Arrays: Theory and Applications, Springer, New York.

See Also

See Also FrF2, oa.design, pb

Examples

Run this code
## only specify level combination 
  fac.design(nlevels=c(4,3,3,2))
  ## design requested via factor.names
  fac.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")))
  ## design requested via character factor.names and nlevels (with a little German lesson for one two three)
  fac.design(factor.names=c("eins","zwei","drei"),nlevels=c(2,3,2))

Run the code above in your browser using DataLab