Main Content

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.

[X,conf] = fracfact(gen) returns a cell array of character vectors containing the confounding pattern for the design.

[X,conf] = fracfact(gen,Name,Value) creates a fractional factorial designs with additional options specified by one or more Name,Value pair arguments.

Input Arguments

gen

Either a string array or cell array of character vectors where each element contains one “word,” or a character array or string scalar consisting of “words” separated by spaces. “Words” consist of case-sensitive letters or groups of letters, where 'a' represents value 1, 'b' represents value 2, ..., 'A' represents value 27, ..., '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.

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.

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

FactorNames

String array or cell array specifying the name for each factor.

Default: {'X1','X2',...}

MaxInt

Positive integer setting the maximum level of interaction to include in the confounding output.

Default: 2

Output Arguments

X

The two-level fractional factorial design. X is 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

Cell array of character vectors containing the confounding pattern for the design.

Examples

Generate 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 =
    -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 using fracfactgen. Use the result to specify the design:

generators = fracfactgen('a b c d e f',4, ... % 4 factors
    4) % resolution 4

generators = 
    'a'
    'b'
    'c'
    'd'
    'bcd'
    'acd'

x = fracfact(generators)

x =
    -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
     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

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