# fracfact

Fractional factorial design

## Syntax

``X = fracfact(gen)``
``````[X,conf] = fracfact(gen)``````
``````[X,conf] = fracfact(gen,Name=Value)``````

## Description

````X = fracfact(gen)` creates the two-level fractional factorial design defined by the generator `gen`.```

example

``````[X,conf] = fracfact(gen)``` also returns the confounding pattern for the design.```
``````[X,conf] = fracfact(gen,Name=Value)``` creates a fractional factorial design with additional options specified by one or more name-value arguments.```

## Examples

collapse all

Create a fractional factorial design for four variables, where the fourth variable is the product of the first three.

`x = fracfact("a b c abc")`
```x = 8×4 -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 ```

Find generators for a six-factor design that uses four factors and achieves resolution IV by using the `fracfactgen` function.

```res = 4; gen = fracfactgen("a b c d e f",4,res)```
```gen = 6x1 cell {'a' } {'b' } {'c' } {'d' } {'bcd'} {'acd'} ```

Create the two-level fractional factorial design defined by the generators.

`x = fracfact(gen)`
```x = 16×6 -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 -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 ⋮ ```

## Input Arguments

collapse all

Generators for the smallest two-level fractional-factorial design, specified as one of the following values.

• A string array or a cell array of character vectors in which each element contains one word.

• A string scalar or character vector consisting of words separated by spaces.

Words are case-sensitive letters or groups of letters, where `"a"` represents value `1`, `"b"` represents value `2`, ..., `"A"` represents value `27`, ..., and `"Z"` represents value `52`. Each word defines how the corresponding factor’s levels are defined as products of generators from a `2^K` full-factorial design. `K` is the number of letters of the alphabet in `gen`.

Example: `["a" "b" "c" "abc"]`

Example: `{'a' 'b' 'c' 'abc'}`

Example: `"a b c abc"`

Example: `'a b c abc'`

Data Types: `string` | `char`

### Name-Value Arguments

Specify optional pairs of arguments as `Name1=Value1,...,NameN=ValueN`, where `Name` is the argument name and `Value` is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: `X = fracfact(gen,MaxInt=3)` specifies the maximum level of interaction as `3`.

Before R2021a, use commas to separate each name and value, and enclose `Name` in quotes.

Example: `X = fracfact(gen,"MaxInt",3)` specifies the maximum level of interaction as `3`.

Name for each factor, specified as a string array or cell array of character vectors. By default, the factor names are `{'X1','X2',...}`.

Data Types: `string` | `char`

Maximum level of interaction to include in the confounding output, specified as a positive integer.

## Output Arguments

collapse all

Two-level fractional factorial design, returned as a matrix of size `N`-by-`P`, where:

• `N` = `2^K`, where `K` is the number of letters of the alphabet in `gen`.

• `P` is the number of words in `gen`.

Because `X` is a two-level design, the components of `X` are `±1`. For the meaning of `X`, see Fractional Factorial Designs.

Confounding pattern for the design, returned as a cell array of character vectors.

## References

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

## Version History

Introduced before R2006a