Documentation

# fracfactgen

Fractional factorial design generators

## Syntax

```generators = fracfactgen(terms) generators = fracfactgen(terms,k) generators = fracfactgen(terms,k,R) generators = fracfactgen(terms,k,R,basic) ```

## Description

`generators = fracfactgen(terms)` uses the Franklin-Bailey algorithm to find generators for the smallest two-level fractional-factorial design for estimating linear model terms specified by `terms`. `terms` is a character vector or string scalar consisting of words formed from the `52` case-sensitive letters `a`-`Z`, separated by spaces. Use `'a'-'z'` for the first 26 factors, and, if necessary, `'A'-'Z'` for the remaining factors. For example, ```terms = 'a b c ab ac'```. Single-letter words indicate main effects to be estimated; multiple-letter words indicate interactions. Alternatively, `terms` is an m-by-n matrix of `0`s and `1`s where m is the number of model terms to be estimated and n is the number of factors. For example, if `terms` contains rows `[0 1 0 0]` and ```[1 0 0 1]```, then the factor `b` and the interaction between factors `a` and `d` are included in the model. `generators` is a cell array of character vectors with one generator per cell. Pass `generators` to `fracfact` to produce the fractional-factorial design and corresponding confounding pattern.

`generators = fracfactgen(terms,k)` returns generators for a two-level fractional-factorial design with 2`k`-runs, if possible. If `k` is `[]`, `fracfactgen` finds the smallest design.

`generators = fracfactgen(terms,k,R)` finds a design with resolution `R`, if possible. The default resolution is `3`.

A design of resolution R is one in which no n-factor interaction is confounded with any other effect containing less than Rn factors. Thus a resolution III design does not confound main effects with one another but may confound them with two-way interactions, while a resolution IV design does not confound either main effects or two-way interactions but may confound two-way interactions with each other.

If `fracfactgen` is unable to find a design at the requested resolution, it tries to find a lower-resolution design sufficient to calibrate the model. If it is successful, it returns the generators for the lower-resolution design along with a warning. If it fails, it returns an error.

`generators = fracfactgen(terms,k,R,basic)` also accepts a vector `basic` specifying the indices of factors that are to be treated as basic. These factors receive full-factorial treatments in the design. The default includes factors that are part of the highest-order interaction in `terms`.

## Examples

Suppose you wish to determine the effects of four two-level factors, for which there may be two-way interactions. A full-factorial design would require 24 = 16 runs. The `fracfactgen` function finds generators for a resolution IV (separating main effects) fractional-factorial design that requires only 23 = 8 runs:

```generators = fracfactgen('a b c d',3,4) generators = 'a' 'b' 'c' 'abc'```

The more economical design and the corresponding confounding pattern are returned by `fracfact`:

```[dfF,confounding] = fracfact(generators) dfF = -1 -1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 1 1 1 1 confounding = 'Term' 'Generator' 'Confounding' 'X1' 'a' 'X1' 'X2' 'b' 'X2' 'X3' 'c' 'X3' 'X4' 'abc' 'X4' 'X1*X2' 'ab' 'X1*X2 + X3*X4' 'X1*X3' 'ac' 'X1*X3 + X2*X4' 'X1*X4' 'bc' 'X1*X4 + X2*X3' 'X2*X3' 'bc' 'X1*X4 + X2*X3' 'X2*X4' 'ac' 'X1*X3 + X2*X4' 'X3*X4' 'ab' 'X1*X2 + X3*X4'```

The confounding pattern shows, for example, that the two-way interaction between `X1` and `X2` is confounded by the two-way interaction between `X3` and `X4`.

## References

 Box, G. E. P., W. G. Hunter, and J. S. Hunter. Statistics for Experimenters. Hoboken, NJ: Wiley-Interscience, 1978.