Make a design of experiment

makeDoe(
  levels,
  type = NULL,
  nTrials = NA,
  minTrials = NULL,
  search = FALSE,
  nRepeats = 5
)

Arguments

levels

A named list of vectors defining each attribute (the names) and each level for each attribute (the vectors). For example, a design with two attributes, "price" and "type", that each had three levels should be defined as levels = list(price = c(1, 2, 3), type = c(1, 2, 3)).

type

The type of design. Defaults to NULL, which returns a full factorial design. Set to "D", "A", and "I" to obtain a fractional factorial design with either D, A, or I optimality criteria.

nTrials

The number of trials to be used in a fractional factorial design. Defaults to NA, but must be a number less than the number of alternatives in the full factorial design if the type argument is anything other than NULL. If search = TRUE, then all feasible designs will be calculated up to nTrials or until a perfect D-efficiency is found.

minTrials

If search == TRUE and minTrials is a number less than or equal to nTrials, then the feasible designs are calculated over the range of minTrials to nTrials. Defaults to NULL, in which case the search starts at the lowest feasible number of levels.

search

If TRUE, all feasible designs are calculated up to nTrials or until a perfect D-efficiency is found, after which a summary of the search results is printed and the top-ranked d-efficient design is returned.

nRepeats

Number of times the design search using AlgDesign::optFederov() is repeated for any one instance of nTrials. Defaults to 5.

Value

Returns a full factorial or fraction factorial design of experiment.

Examples

# Define the attributes and levels
levels <- list(
  price     = seq(1, 4, 0.5), # $ per pound
  type      = c('Fuji', 'Gala', 'Honeycrisp', 'Pink Lady', 'Red Delicious'),
  freshness = c('Excellent', 'Average', 'Poor')
)

# Make a full-factorial design of experiment
doe <- makeDoe(levels)

# Make a fraction-factorial design of experiment based on D-efficiency
doe <- makeDoe(levels, type = "D", nTrials = 100)
#>   nTrials     d balanced
#> 1     100 0.913    FALSE