Skip to contents

Generates a 2^k full factorial design.

Usage

facDesign(
  k = 3,
  p = 0,
  replicates = 1,
  blocks = 1,
  centerCube = 0,
  random.seed = 1234
)

Arguments

k

Numeric value giving the number of factors. By default k is set to `3`.

p

Numeric integer between `0` and `7`. p is giving the number of additional factors in the response surface design by aliasing effects. For further information see fracDesign and fracChoose. By default p is set to `0`.

replicates

Numeric value giving the number of replicates per factor combination. By default replicates is set to `1`.

blocks

Numeric value giving the number of blocks. By default blocks is set to `1`. Blocking is only performed for k greater 2.

centerCube

Numeric value giving the number of centerpoints within the 2^k design. By default centerCube is set to `0`.

random.seed

Numeric value for setting the random seed for reproducibility.

Value

The function facDesign returns an object of class facDesign.c.

Examples

# Example 1
vp.full <- facDesign(k = 3)
vp.full$.response(rnorm(2^3))
vp.full$summary()
#> Information about the factors:
#> 
#>            A       B       C
#> low       -1      -1      -1
#> high       1       1       1
#> name       A       B       C
#> unit                        
#> type numeric numeric numeric
#> -----------
#>   StandOrder RunOrder Block  A  B  C  rnorm.2.3.
#> 7          7        1     1 -1  1  1  0.03572991
#> 2          2        2     1  1 -1 -1  0.11297506
#> 6          6        3     1  1 -1  1  1.42855203
#> 1          1        4     1 -1 -1 -1  0.98340378
#> 4          4        5     1  1  1 -1 -0.62245679
#> 3          3        6     1 -1  1 -1 -0.73153600
#> 8          8        7     1  1  1  1 -0.51666972
#> 5          5        8     1 -1 -1  1 -1.75073344

# Example 2
vp.rep <- facDesign(k = 2, replicates = 3, centerCube = 4)
vp.rep$names(c("Name 1", "Name 2"))
vp.rep$unit(c("min", "F"))
vp.rep$lows(c(20, 40, 60))
vp.rep$highs(c(40, 60, 80))
vp.rep$summary()
#> Information about the factors:
#> 
#>       Name 1  Name 2
#> low       20      40
#> high      40      60
#> name  Name 1  Name 2
#> unit     min       F
#> type numeric numeric
#> -----------
#>    StandOrder RunOrder Block  A  B  y
#> 16         16        1     1  0  0 NA
#> 11         11        2     1 -1  1 NA
#> 14         14        3     1  0  0 NA
#> 10         10        4     1  1 -1 NA
#> 4           4        5     1  1  1 NA
#> 3           3        6     1 -1  1 NA
#> 15         15        7     1  0  0 NA
#> 9           9        8     1 -1 -1 NA
#> 6           6        9     1  1 -1 NA
#> 2           2       10     1  1 -1 NA
#> 12         12       11     1  1  1 NA
#> 1           1       12     1 -1 -1 NA
#> 7           7       13     1 -1  1 NA
#> 8           8       14     1  1  1 NA
#> 13         13       15     1  0  0 NA
#> 5           5       16     1 -1 -1 NA

# Example 3
dfac <- facDesign(k = 3, centerCube = 4)
dfac$names(c('Factor 1', 'Factor 2', 'Factor 3'))
dfac$names()
#> [1] "Factor 1" "Factor 2" "Factor 3"
dfac$lows(c(80, 120, 1))
dfac$lows()
#> $`Factor 1`
#> [1] 80
#> 
#> $`Factor 2`
#> [1] 120
#> 
#> $`Factor 3`
#> [1] 1
#> 
dfac$highs(c(120, 140, 2))
dfac$highs()
#> $`Factor 1`
#> [1] 120
#> 
#> $`Factor 2`
#> [1] 140
#> 
#> $`Factor 3`
#> [1] 2
#> 
dfac$summary()
#> Information about the factors:
#> 
#>      Factor 1 Factor 2 Factor 3
#> low        80      120        1
#> high      120      140        2
#> name Factor 1 Factor 2 Factor 3
#> unit                           
#> type  numeric  numeric  numeric
#> -----------
#>    StandOrder RunOrder Block  A  B  C  y
#> 7           7        1     1 -1  1  1 NA
#> 9           9        2     1  0  0  0 NA
#> 12         12        3     1  0  0  0 NA
#> 5           5        4     1 -1 -1  1 NA
#> 4           4        5     1  1  1 -1 NA
#> 3           3        6     1 -1  1 -1 NA
#> 6           6        7     1  1 -1  1 NA
#> 10         10        8     1  0  0  0 NA
#> 8           8        9     1  1  1  1 NA
#> 2           2       10     1  1 -1 -1 NA
#> 11         11       11     1  0  0  0 NA
#> 1           1       12     1 -1 -1 -1 NA