# fracfact

Fractional factorial design

## Description

`[`

creates
a fractional factorial design with additional options specified by one or more
name-value arguments.`X`

,`conf`

]
= fracfact(`gen`

,`Name=Value`

)

## Examples

### Fractional Factorial Design for Four Variables

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

### Six-Factor Design with Resolution IV

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

`gen`

— Generators

string array | cell array of character vectors | string scalar | character vector

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`

.

`FactorNames`

— Name for each factor

string array | cell array of character vectors

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`

`MaxInt`

— Maximum level of interaction

`2`

(default) | positive integer

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

## Output Arguments

`X`

— Two-level fractional factorial design

matrix

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.

`conf`

— Confounding pattern for the design

cell array of character vectors

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**

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)