The R package

The R package

For a very basic example, consider an experiment on three brands of baking powder (B1, B2, B3), combined with two types of oven (electric versus gas) and two different recipes (old versus new). A combination of levels with which to conduct the experiment is called an “experimental run”. For this simple example, there are 3⋅2⋅2 = 12 different level combinations (see Table

Full factorial design in lexicographic order, with counting vector

r | recipe | bp | oven |
---|---|---|---|

1 | new | B1 | elect |

0 | new | B1 | gas |

1 | new | B2 | elect |

0 | new | B2 | gas |

0 | new | B3 | elect |

1 | new | B3 | gas |

0 | old | B1 | elect |

1 | old | B1 | gas |

0 | old | B2 | elect |

1 | old | B2 | gas |

1 | old | B3 | elect |

0 | old | B3 | gas |

_{0}, _{1}, …, _{m}_{0} (for the overall mean) is always 1. In a full factorial design, all other entries are zeroes, i.e. _{1}, …, _{m}_{R}_{j}_{1} = _{2} = 0. This is also denoted as strength 2: the strength is one less than the resolution. For strength 2, all pairs (=2-tuples) of factors (when ignoring the presence of the other factors) are full factorials or balanced replications of full factorials. The entry _{j}

As was mentioned above, the unreplicated full factorial design of Table _{0}, _{1}, _{2}, _{3}) = (1, 0, 0, 0). The three fractional factorial designs of Table _{1} is already positive; this is caused by the imbalance in factor oven. Designs 2 and 3 have at least resolution II (strength 1), i.e. all factors are balanced (usually considered as the minimum requirement), while pairs of factors are not all balanced. Design 2 is worse than Design 3, because its _{2} entry is larger; this is due to the imbalance between factors oven and bp, which is not present in Design 3. One would usually strive to achieve at least resolution III; with this very small design, this is not possible in less than a full factorial. Whether or not a certain strength is possible can be checked using function

Three small fractional factorial designs.

Design 1 | Design 2 | Design 3 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|

run | recipe | bp | oven | run | recipe | bp | oven | run | recipe | bp | oven | ||

1 | new | B1 | elect | 1 | new | B1 | elect | 1 | new | B1 | elect | ||

2 | new | B2 | elect | 2 | new | B2 | gas | 2 | new | B2 | elect | ||

3 | new | B3 | gas | 3 | new | B3 | gas | 3 | new | B3 | gas | ||

4 | old | B1 | elect | 4 | old | B1 | elect | 4 | old | B1 | gas | ||

5 | old | B2 | gas | 5 | old | B2 | gas | 5 | old | B2 | gas | ||

6 | old | B3 | elect | 6 | old | B3 | elect | 6 | old | B3 | elect |

Mosaic plots are a good way to demonstrate imbalance (see e.g. [_{3} for 72 runs. The reference plots in the top row show the worst case possible balance for a resolution III triple of three factors with 2, 2, and 4 levels, and the best possible balance achievable in a full factorial design (not achievable in 72 runs).

Worst case balance for two plans, compared to worst and best case references.

Why does balance matter? This is most easily explained when looking at the worst case picture: in the top left mosaic plot of Figure _{3}-value of the better array consists of six identical non-zero contributions from all six triples with 2, 2, and 4 levels that exhibit the balance shown in the bottom right plot of Figure

The counting vector

Grömping and Fontana ([

The design is expressed in terms of the counting vector

The requested resolution

Subsequently, ^{2}_{R}^{2}_{R}^{T}

Potentially, subsequent optimization steps may take care of optimizing further elements of the GWLP, with additional conic quadratic constraints for preserving optimality of already optimized elements of the GWLP.

In principle, it is possible to apply function _{R}_{m}

In many applications of practical relevance, one will have to constrain optimization to the most important entry _{R}_{R}_{R}_{3} confirmed optimization success.

Note, that the properties of the space in which optimization is conducted may strongly depend on the ordering of the experimental factors (through the ordering of the numbers of factor levels). An optimum design can be found very fast for some level orderings, while it may take much longer to find the optimum for other cases. Therefore, package

The CRAN Task View “Design of Experiments (DoE) & Analysis of Experimental Data” discusses R packages that are on CRAN and support experimental design tasks. This brief section comments on a small selection of those packages that could be used for similar applications as

The R package

For a specific number of runs, a vector of numbers of factor levels, and a resolution _{R}_{k}_{max}; if _{max} = _{max} =

Where the previous strategy is not successful, try to optimize _{R}

Continue optimization efforts, starting from an earlier optimization result. One can try to further improve the previous attempt, e.g. further reduce _{R}

The above-mentioned user-visible optimization functions implement the overall algorithm that is described in [

Apart from a few parameters that are explicitly accessed by specific arguments of the functions of package

The internal functions

The optimization functions of package

Changes in results have occurred with version updates of Gurobi and particularly Mosek; this is due to changed algorithmic decisions within the softwares and can for specific examples be both beneficial or detrimental: for example, the code that produced the optimum design that could have replaced the design used in [_{3} in Mosek version 9. Different results than those reported in [

All systems that run R 3.3 or higher

R 3.3 or higher

Availability of several cores is beneficial.

Availability of large RAM is beneficial.

Availability of Mosek 8 or higher and/or Gurobi 7.5. or higher.

R packages: combinat, DoE.base, gurobi (from vendor) and/or Rmosek (from vendor), slam (>= 0.1–9), Matrix (>= 1.1.0).

Hongquan Xu (UCLA) contributed code for function GWLP which is imported from package

English

Extensions to other optimizers (e.g. CPLEX [

Likewise, Gurobi and Mosek have APIs for other softwares, e.g. Python or Matlab. Software developers are welcome to adapt

There is no official support for this software, but interested users can contact the author by e-mail. Bug reports are of course welcome and will be acted upon.

The collaboration with Roberto Fontana triggered the creation of the software.

The author has no competing interests to declare.