Generate a Box-Behnken design
bbd.Rd
This function can generate a Box-Behnken design in 3 to 7 factors, and optionally will block it orthogonally if there are 4 or 5 factors. It can also randomize the design.
Arguments
- k
A formula, or an integer giving the number of variables. If the formula has a left-hand side, the variables named there are appended to the design and initialized to
NA
.- n0
Number of center points in each block.
- block
Logical value specifying whether or not to block the design; or a character string (taken as
TRUE
) giving the desired name for the blocking factor. Only BBDs with 4 or 5 factors can be blocked. A 4-factor BBD has three orthogonal blocks, and a 5-factor BBD has two.- randomize
Logical value determining whether or not to randomize the design. If
block
isTRUE
, each block is randomized separately.- coding
Optional list of formulas. If this is provided, it overrides the default coding formulas.
Details
Box-Behnken designs (BBDs) are useful designs for fitting second-order response-surface models. They use only three levels of each factor (compared with 5 for central-composite designs) and sometimes fewer runs are required than a CCD. This function uses an internal table of BBDs; it only works for 3 to 7 factors.
If k
is specified as a formula, the names in the formula determine the names of the factors in the generated design. Otherwise, the names will be x1, x2, ...
. If coding
is not specified, default codings are created in the form x ~ x.as.is.
Value
A coded.data
object with the generated design and the additional valiables run.order
and std.order
. The blocking variable, if present, will be a factor
; all other variables will be numeric.
Note
To avoid aliasing the pure-quadratic terms, you must use a positive value of n0
.
The non-exported function rsm:::.bbd.1.41
is provided in case it is needed by other packages for compatibility with old versions of rsm (version 1.41 or earlier). Given the same seed, it will also reproduce the randomization as a previously generated design from an old version.
References
Lenth RV (2009) ``Response-Surface Methods in R, Using rsm'', Journal of Statistical Software, 32(7), 1--17. doi:10.18637/jss.v032.i07
Myers, RH, Montgomery, DC, and Anderson-Cook, CM (2009) Response Surface Methodology (3rd ed.), Wiley.
Examples
library(rsm)
### Simple 3-factor case, not randomized so structure is evident
bbd(3, randomize=FALSE)
#> run.order std.order x1.as.is x2.as.is x3.as.is
#> 1 1 1 -1 -1 0
#> 2 2 2 1 -1 0
#> 3 3 3 -1 1 0
#> 4 4 4 1 1 0
#> 5 5 5 -1 0 -1
#> 6 6 6 1 0 -1
#> 7 7 7 -1 0 1
#> 8 8 8 1 0 1
#> 9 9 9 0 -1 -1
#> 10 10 10 0 1 -1
#> 11 11 11 0 -1 1
#> 12 12 12 0 1 1
#> 13 13 13 0 0 0
#> 14 14 14 0 0 0
#> 15 15 15 0 0 0
#> 16 16 16 0 0 0
#>
#> Data are stored in coded form using these coding formulas ...
#> x1 ~ x1.as.is
#> x2 ~ x2.as.is
#> x3 ~ x3.as.is
### 5-factor BBD, divided between two plants
bbd(y1 + y2 ~ A + B + C + D + E, n0 = 5, block = "Plant")
#> run.order std.order Plant A.as.is B.as.is C.as.is D.as.is E.as.is y1 y2
#> 1 1 24 1 0 0 0 0 0 NA NA
#> 2 2 14 1 0 0 0 1 -1 NA NA
#> 3 3 25 1 0 0 0 0 0 NA NA
#> 4 4 8 1 1 0 1 0 0 NA NA
#> 5 5 4 1 1 1 0 0 0 NA NA
#> 6 6 5 1 -1 0 -1 0 0 NA NA
#> 7 7 15 1 0 0 0 -1 1 NA NA
#> 8 8 13 1 0 0 0 -1 -1 NA NA
#> 9 9 10 1 0 0 1 -1 0 NA NA
#> 10 10 17 1 0 -1 0 0 -1 NA NA
#> 11 11 22 1 0 0 0 0 0 NA NA
#> 12 12 3 1 -1 1 0 0 0 NA NA
#> 13 13 1 1 -1 -1 0 0 0 NA NA
#> 14 14 16 1 0 0 0 1 1 NA NA
#> 15 15 6 1 1 0 -1 0 0 NA NA
#> 16 16 19 1 0 -1 0 0 1 NA NA
#> 17 17 23 1 0 0 0 0 0 NA NA
#> 18 18 18 1 0 1 0 0 -1 NA NA
#> 19 19 12 1 0 0 1 1 0 NA NA
#> 20 20 7 1 -1 0 1 0 0 NA NA
#> 21 21 9 1 0 0 -1 -1 0 NA NA
#> 22 22 11 1 0 0 -1 1 0 NA NA
#> 23 23 2 1 1 -1 0 0 0 NA NA
#> 24 24 20 1 0 1 0 0 1 NA NA
#> 25 25 21 1 0 0 0 0 0 NA NA
#> 26 1 38 2 0 -1 0 -1 0 NA NA
#> 27 2 33 2 1 0 0 0 1 NA NA
#> 28 3 41 2 0 1 0 1 0 NA NA
#> 29 4 35 2 0 1 -1 0 0 NA NA
#> 30 5 46 2 0 0 0 0 0 NA NA
#> 31 6 30 2 -1 0 0 0 -1 NA NA
#> 32 7 28 2 -1 0 0 1 0 NA NA
#> 33 8 36 2 0 -1 1 0 0 NA NA
#> 34 9 31 2 1 0 0 0 -1 NA NA
#> 35 10 32 2 -1 0 0 0 1 NA NA
#> 36 11 27 2 1 0 0 -1 0 NA NA
#> 37 12 49 2 0 0 0 0 0 NA NA
#> 38 13 42 2 0 0 -1 0 -1 NA NA
#> 39 14 39 2 0 1 0 -1 0 NA NA
#> 40 15 48 2 0 0 0 0 0 NA NA
#> 41 16 47 2 0 0 0 0 0 NA NA
#> 42 17 34 2 0 -1 -1 0 0 NA NA
#> 43 18 40 2 0 -1 0 1 0 NA NA
#> 44 19 50 2 0 0 0 0 0 NA NA
#> 45 20 43 2 0 0 1 0 -1 NA NA
#> 46 21 29 2 1 0 0 1 0 NA NA
#> 47 22 26 2 -1 0 0 -1 0 NA NA
#> 48 23 44 2 0 0 -1 0 1 NA NA
#> 49 24 45 2 0 0 1 0 1 NA NA
#> 50 25 37 2 0 1 1 0 0 NA NA
#>
#> Data are stored in coded form using these coding formulas ...
#> A ~ A.as.is
#> B ~ B.as.is
#> C ~ C.as.is
#> D ~ D.as.is
#> E ~ E.as.is