Main Content

fracfactgen

Two-level fractional factorial design generators

Description

generators = fracfactgen(terms) returns a cell array containing generators for the smallest two-level fractional factorial design for estimating the linear model terms specified by terms. Pass generators to fracfact to produce the design and its confounding pattern.

generators = fracfactgen(terms,k) returns generators for a design with 2k runs, if possible. If k is [], then fracfactgen returns generators for the smallest possible design.

generators = fracfactgen(terms,k,res) returns generators for a design with the resolution res, if possible. If fracfactgen is unable to find a design at the specified resolution, it tries to find a lower resolution design that is sufficient to calibrate the model.

example

generators = fracfactgen(terms,k,res,basic) returns generators for a design in which the factors in basic receive full factorial treatment. If you do not specify basic, then fracfactgen includes factors that are part of the highest order interaction in terms.

Examples

collapse all

Create generators for a fractional factorial design that determines the effects of four two-level factors, which might involve two-way interactions. Specify that the design is resolution IV and contains a maximum of 23=8 runs, if possible.

k = 3;   % Base-2 logarithm of maximum number of design runs
Res = 4;   % Resolution
generators = fracfactgen("a b c d",k,Res)
generators = 4x1 cell
    {'a'  }
    {'b'  }
    {'c'  }
    {'abc'}

Pass the generators to the fracfact function to return the design and its confounding pattern.

[dff,confounding] = fracfact(generators)
dff = 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

confounding = 11x3 cell
    {'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'}

fracfact generates a more economical design than the full factorial design, which requires 24=16 runs.

The confounding pattern shows that the design is resolution IV. For example, the two-way interaction between X1 and X2 is confounded by the two-way interaction between X3 and X4.

Input Arguments

collapse all

Model terms, specified as 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 "A""Z" for the remaining factors, if necessary. Use single-letter words to indicate main effects to be estimated, and multiple-letter words to indicate interactions. For example, "a b c d ac" defines a model that includes the main effects for factors ad, and the interaction between factors a and c. You cannot specify more than 52 factors.

Alternatively, you can specify terms as an m-by-n matrix of 0s and 1s, 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 model includes factor b and the interaction between factors a and d.

Example: "a b c ac"

Example: [0 1 0 0; 1 0 0 1]

Data Types: single | double | char | string

Base-2 logarithm of the maximum number of design runs, specified as a positive integer scalar greater than or equal to 2. fracfactgen returns generators for a two-level fractional factorial design with 2k runs, if possible. If k is [], then fracfactgen returns generators for the smallest design.

Example: 3

Data Types: single | double

Resolution of the fractional factorial design, specified as a positive integer scalar greater than or equal to 3. If fracfactgen is unable to find a design at the specified resolution, it tries to find a lower resolution design that is sufficient to calibrate the model. If the function is successful, it returns the generators for the lower resolution design, and issues a warning. If the function is unsuccessful, it issues an error.

In a design of resolution res, no n-factor interaction is confounded with any other effect containing fewer than resn factors. So, a resolution III design does not confound main effects with each other, but might confound them with two-way interactions. A resolution IV design does not confound main effects with each other, and does not confound main effects with two-way interactions. However, it might confound two-way interactions with each other.

Example: 4

Data Types: single | double

Indices of elements in terms to treat as basic factors, specified as a vector of k distinct positive integers in the range [1, s], where s is the number of factors in terms. Basic factors receive full factorial treatment in the design. If you do not specify basic, then fracfactgen includes factors that are part of the highest order interaction in terms. The function ignores the value of basic if the requested design is full factorial.

Example: [1 2 3]

Data Types: single | double

Output Arguments

collapse all

Generators for a two-level fractional factorial design, returned as a cell array of character vectors with one generator per cell. fracfactgen uses the Franklin-Bailey algorithm [2] to find generators for the smallest two-level fractional factorial design for estimating the linear model terms specified by terms. Pass generators to fracfact to produce the fractional factorial design and its confounding pattern.

References

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

[2] Franklin, M. F., and R. A. Bailey. “Selection of Defining Contrasts and Confounded Effects in Two-Level Experiments,” Applied Statistics 26, no. 3 (1977): 321–26.

Version History

Introduced in R2006a