# ffDesMatrix: Full or fractional factorial design matrix generation In BHH2: Useful Functions for Box, Hunter and Hunter II

## Description

The function generates the design matrix provided the number of 2-levels design factors and defining relations.

## Usage

 `1` ```ffDesMatrix(k, gen = NULL) ```

## Arguments

 `k` numeric. The number of 2-levels design factors in the designs. `gen` list. If `NULL` (default) a full factorial design is generated. Otherwise, each component of the list is a numeric vector of corresponding to each of the defining relations used to compose the design. See Details.

## Details

A defining relation is declared by a vector where the first entry corresponds to the left hand side (LHS) of the defining equation. For example, if `k=5`, and `gen=list(c(-5,1,2,3,4))`, then the defining equation is -5=1*2*3*4. A full 2-levels (-1,1) factorial design is generated. For each defining relation the LHS column is replaced by the corresponding columns product. At the end repeated runs are removed from the matrix.

## Value

The function returns a 2-levels design matrix with `k` columns.

Ernesto Barrios

## See Also

`conf.design` of the conf.design package, `FrF2` from the FrF2 package.

## Examples

 ```1 2 3``` ```ffDesMatrix(5) # Full 2^5 factorial design ffDesMatrix(5,gen=list(c(5,1,2,3,4))) # 2^(5-1) factorial design ffDesMatrix(5,gen=list(c(4,1,2),c(-5,1,3))) # 2^(5-2) factorial design ```

### Example output

```      [,1] [,2] [,3] [,4] [,5]
[1,]   -1   -1   -1   -1   -1
[2,]    1   -1   -1   -1   -1
[3,]   -1    1   -1   -1   -1
[4,]    1    1   -1   -1   -1
[5,]   -1   -1    1   -1   -1
[6,]    1   -1    1   -1   -1
[7,]   -1    1    1   -1   -1
[8,]    1    1    1   -1   -1
[9,]   -1   -1   -1    1   -1
[10,]    1   -1   -1    1   -1
[11,]   -1    1   -1    1   -1
[12,]    1    1   -1    1   -1
[13,]   -1   -1    1    1   -1
[14,]    1   -1    1    1   -1
[15,]   -1    1    1    1   -1
[16,]    1    1    1    1   -1
[17,]   -1   -1   -1   -1    1
[18,]    1   -1   -1   -1    1
[19,]   -1    1   -1   -1    1
[20,]    1    1   -1   -1    1
[21,]   -1   -1    1   -1    1
[22,]    1   -1    1   -1    1
[23,]   -1    1    1   -1    1
[24,]    1    1    1   -1    1
[25,]   -1   -1   -1    1    1
[26,]    1   -1   -1    1    1
[27,]   -1    1   -1    1    1
[28,]    1    1   -1    1    1
[29,]   -1   -1    1    1    1
[30,]    1   -1    1    1    1
[31,]   -1    1    1    1    1
[32,]    1    1    1    1    1
[,1] [,2] [,3] [,4] [,5]
[1,]   -1   -1   -1   -1    1
[2,]    1   -1   -1   -1   -1
[3,]   -1    1   -1   -1   -1
[4,]    1    1   -1   -1    1
[5,]   -1   -1    1   -1   -1
[6,]    1   -1    1   -1    1
[7,]   -1    1    1   -1    1
[8,]    1    1    1   -1   -1
[9,]   -1   -1   -1    1   -1
[10,]    1   -1   -1    1    1
[11,]   -1    1   -1    1    1
[12,]    1    1   -1    1   -1
[13,]   -1   -1    1    1    1
[14,]    1   -1    1    1   -1
[15,]   -1    1    1    1   -1
[16,]    1    1    1    1    1
[,1] [,2] [,3] [,4] [,5]
[1,]   -1   -1   -1    1   -1
[2,]    1   -1   -1   -1    1
[3,]   -1    1   -1   -1   -1
[4,]    1    1   -1    1    1
[5,]   -1   -1    1    1    1
[6,]    1   -1    1   -1   -1
[7,]   -1    1    1   -1    1
[8,]    1    1    1    1   -1
```

BHH2 documentation built on May 1, 2019, 6:27 p.m.