# Difference between revisions of "Doegen"

imported>Scott (→See Also) |
imported>Scott (→See Also) |
||

Line 73: | Line 73: | ||

===See Also=== | ===See Also=== | ||

− | [[distslct]], [[doptimal]],[[factdes]], [[ffacdes1]], [[stdsslct]] | + | [[distslct]], [[doptimal]], [[factdes]], [[ffacdes1]], [[stdsslct]] |

## Revision as of 11:57, 3 September 2011

## Contents

### Purpose

Generate a Design of Experiments (DOE) DataSet object.

### Synopsis

- [doe,msg] = doegen(type,factors,scales,levels,options)

### Description

Creates a Design of Experiements of a specified type with named factors designed with a specified number of levels and coding of those levels at specified values or categorical names.

Designs can be a mix of numerical and categorical factors. The type of factor is defined by the "scales" input which specifies either the minimum and maximum values to use (numerical factor), the exact numerical values to be used (numerical factor), or the names of the categories (categorical factor).

Some design types have a specific number of levels which they allow. If one or more categorical factors requires a different number of levels than the design allows, the design is calculated without these categorical factor(s) and then replicated for all levels of the factor(s). This may increase the number of required samples beyond what is expected but provides full resolution of categorical factors in designs which would otherwise be incompatible with them.

#### Inputs

**type**= Type of design to create:

- 'full' = full factorial
- '2' = 1/2 factorial (2-level)
- '4' = 1/4 factorial (2-level)
- '8' = 1/8 factorial (2-level)
- '16' = 1/16 factorial (2-level)
- 'face' = Face-centered Central Composite (3-level)
- 'sphere' = Sperical Central Composite (5-level)
- 'box' = Box-Behnken Design (3-level)

**factors**= Cell array indicating the name(s) of the factors. The number of strings indicates the total number of factors in the design.**scales**= Cell array containing either double vectors (for numerical factors) or cell arrays of strings (for categorical factors). For numerical factors, the doubles indicate the minimum and maximum values for each factor's levels (if only two values are in a given cell) or the specific level values (if more than two values are in the cell). If only two values are supplied, the number of levels to use must be passed in the (levels) input. For categorical factors, number of strings in the cell array defines the number of levels for the given factor.

- Example:
`{ [5 8 9 10] [ 100 200 ] {'treat A' 'treat B'} }`- Defines scaling for three factors. The first two are numerical factors: one with four specific levels (equal to 5 8 9 10), one with a min/max of 100 and 200, and a third categorical factor with the labels indicated for the two categories. If using a full-factorial design and the second factor should have more than two levels, the (levels) input must be provided (see below.)

#### Optional Inputs

**levels**= Vector specifying the number of levels to use for each factor in a full-factorial design. Although a vector equal in length to the number of factors must be supplied, the values are ONLY used for non-categorical (i.e. numeric) factors when (scales) has been specified with only two values (min/max) and only for full-factorial designs. In all other cases, the number of levels is either predefined by the design or the number of elements in the (scales) input. However, when required by any factor, a value must be supplied for all factors (even if only a placeholder value). For example, if (scales) defines three factors:

`{ [5 8 9 10] [ 100 200 ] {'treat A' 'treat B'} }`- then factors 1 and 3 are unambiguiously defined as having 4 and 2 levels, respectively. If the (levels) input is not provided, it will be assumed that factor 2 should have only two levels. If factor 2 should have more levels, for example, 3 levels at 100 150 and 200, the levels input needs to be defined as:
`[ 4 3 2]`- Notice that this input can be completely dropped if the (scales) input specifically defines the number and values of all factor levels.

#### Outputs

**doe**= Design of Experiments DataSet object containing classes, labels, and additional userdata information on the design.**msg**= If requested as an output, design errors (such as incompatible settings between design type and number of levels or factor types) are squelched and returned in this string. When an error is discovered, the (doe) output will be empty. Errors in input format or general usage are still thrown as standard errors.

### Options

options = a structure array with the following fields:

**interactions**: [1] Specify what type interactions to include in the final DOE as a scalar numerical value indicating the highest number of interacting factors to include (A value of 1 (one) indicates no interactions) or as a cell array of numerical vectors indicating which column(s) should be combined an in what way(s) to create the interaction terms. Example:`{ [1] [2] [3] [1 3] }`**randomize**: [ 'no' | {'yes'} ] Specify whether to reorder the output design to a randomized order. Whether or not this randomize option is used, a randomized axisscale is created in the output which can be used to reorder the experiments. In addition, an "original order" axisscale is also created to allow re-ordering to the original unrandomized DOE order.**centerpoints**: [0] Number of additional center points to add to the design. Note that center points are calculated for all numerical factors (whether or not they had a center point to begin with) and these points are replicated for all combinations of categorical factors. Thus, the total number of center points added will be the product of the number requested times the number of combinations of categorical variables in the design.

### Example

Create a face-centered central composite design with one categorical factor named 'Processor' with categories 'J' and 'K', and two numeric factors, one named 'ethylene %' at evenly spaced levels between 1 and 5 and one named 'butene %' at the specific levels 0, 4, and 6.

doe = doegen('face',{'Processor' 'ethylene %' 'butene %'},{{'J' 'K'} [1 5] [0 4 6] });

Create a 1/2 fractional factorial (3-1) screening design with the same factors except the butene is screened at only 0 and 6%.

doe = doegen('1/2',{'Processor' 'ethylene %' 'butene %'},{{'J' 'K'} [1 5] [0 6] });

Create a full-factorial design with the same factors but with specific levels for all factors. Note that ethylene % scales are given as min/max values of 1 and 5 but the (levels) input specifies that it should be evaluated at 4 levels. The other two factors are specifically defined at 2 and 3 levels both by their (scales) input as well as the (levels) input:

doe = doegen('full',{'Processor' 'ethylene %' 'butene %'},{{'J' 'K'} [1 5] [0 3 6] },[2 4 3]);