Learn R Programming

rsm (version 1.40)

ccd: Generate a central-composite design

Description

This function can generate a broad range of central-composite designs with flexible choices of replications, aliasing of predictors and fractional blocks, and choices of axis or 'star' points.

Usage

ccd(basis, generators, blocks = "Block", n0 = 4, alpha = "orthogonal", 
    wbreps = 1, bbreps = 1, randomize = TRUE, inscribed = FALSE, coding)

Arguments

basis
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.
generators
Optional formula or list of formulas to generate aliased variables
blocks
A string or a formula. If a character string, it is the name of the blcoking factor; if a formula, the left-hand side is used as the name of the blcoking factor, and the formula(s) on the right-hand side are used to generate separate fractional blocks.
n0
Integer or vector of two integers giving the number of center points. If only one value, this is the number of center pouints in each block. If two values are given, n0[1] specifies the number of center points in 'cube' blocks
alpha
If numeric, the position of the 'star' points. May also be a character string; if it matches "orthogonal",the star points are positioned to block the design orthogonally; if it matches "rotatable", the star points are chosen to
wbreps
Number(s) of within-block replications. If this is a vector of length 2, then separate numbers are used for the 'cube' and the 'axis' blocks respectively.
bbreps
Number(s) of between-block replications (i.e., number of repeats of each block). f this is a vector of length 2, then separate numbers are used for the 'cube' and the 'axis' blocks respectively.
randomize
Boolean determining whether or not to randomize the design. Each block is randomized separately.
inscribed
Boolean value. If FALSE, the cube points are at +/- 1 and the axis points are at least 1. If TRUE, the entire desgn is scaled down so that the axis points are at +/- 1 and the cube points are at interior positions.
coding
Optional list of formulas. If this is provided, a coded.data object is returned with the specified coding.

Value

  • A data.frame with the generated design; or if coding is specified, a coded.data object. The blocking variable will be a factor; all other variables will be numeric.

Details

Central-composite designs (CCDs) are popular designs for use in response-surface exploration. They are blocked designs consisting of at least one 'cube' block (two-level factorial or fractional factorial, plus center points) , and at least one 'star' block (points along each axis at positions -alpha and +alpha), plus center points. Everything is assumed to be on a coded scale, where the cube portion of the design has values of -1 and 1 for each variable, and the center points are 0. The codings may be provided, if desired, using the coding argument. The basis argument determines a basic design used to create cube blocks. For example, basis = ~A+B+C would generate a basic design of 8 runs. Use generators if you want additional variables; for example, generators = c(D~-A*B, E~B*C) added to the above would generate a 5-factor design with defining relation I = -ABD = BCE = -ACDE. If you want the cube points divided into fractional blocks, give the formula(s) in the blocks argument. For instance, suppose we have basis = A+B+C+D+E, generators = F~-A*C*D, and blocks = Day ~ c(A*B*C, C*D*E). Then the blocking variable will be named "Day", and the basic 32-run design (half-fraction of 6 factors) will be divided into 4 blocks of 8 runs each, based on the combination of signs of A*B*C and C*D*E. Notice that Day will be confounded with its generators, the interaction thereof, and all aliases of these: Day = ABC = CDE = ABDE = -BDF = -ADCF = -BCEF = -AEF. To each of these blocks, we will add n0 (or n0[1]) center points. A star block contains n0 (or n0[2]) center points, plus points at +/- alpha on each coordinate axis. You may specify the alpha you want, or have it chosen to achieve orthogonality of blocks (the default) or rotatability. Conditions for these criteria to hold are described in detail in references such as Myers and Montgomery (2005). In cases where there are constraints on the possible design-point values, you may want to specify inscribed = TRUE. This will scale-down the design so that no coded value exceeds 1. wbreps values greater than 1 cause cube points or star points to be replicated in the same block. bbreps values greater than 1 cause additional blocks to be added to the design. By default, the design is randomized so that the run order in each block is random. The order of appearance of the blocks is not randomized. A couple of convenience features are added. If basis is an integer instead of a formula, default variable names of x1, x2, ... are used; for example, basis = 3 is equivalent to basis = ~x1+x2+x3. You may specify generators or fractional blocks using the same notation. You may also give variables on the left-hand side when basis is a formula, and these variables are added to the returned design. For example, Yield+ProcessTime ~ A+B+C would generate a design in factors A, B, C (plus others if there are generators), and additional variables Yield and ProcessTime initialized at NA.

References

Lenth RV (2009). ``Response-Surface Methods in R, Using rsm'', Journal of Statistical Software, 32(7), 1--17. http://www.jstatsoft.org/v32/i07/. Myers, RH, Montgomery, DC, and Anderson-Cook, CM (2009), Response Surface Methodology (3rd ed.), Wiley.

See Also

ccd.pick, coded.data, bbd

Examples

Run this code
library(rsm)

### Generate a standard 3-variable CCD with 12 runs in each block
des = ccd(3, n0=c(4,6), coding = list(x1 ~ (Temp - 150)/10, 
          x2 ~ (Pres - 50)/5, x3 ~ Feedrate - 4))
decode.data(des)

### Same as above, except make the design rotatable,
###   and inscribed so that no coded value exceeds 1
des2 = ccd(3, n0=c(4,6), alpha = "rotatable", inscribed = TRUE,
    coding = list(x1 ~ (Temp - 150)/10, 
          x2 ~ (Pres - 50)/5, x3 ~ Feedrate - 4))
decode.data(des2)

### Generate a 5-variable design in 2 blocks.  The cube block has 16 runs
### This design will have alpha = 2; it is both orthogonal and rotatable
ccd(~ x1 + x2 + x3 + x4,  x5 ~ x1 * x2 * x3 * x4, n0 = c(6,1))

### Generate a 5-variable design with 5 blocks:
### 4 blocks of 8 cube points each, and 1 block with star points 
### You'll get alpha = 2.366; if you add alpha = "rot", you'll get 2.378
des = ccd(y1 + y2 ~ A + B + C + D + E, , Shift ~ c(-A*B*C, C*D*E), n0=c(2,4))

Run the code above in your browser using DataLab