Description Usage Arguments Details Value Note Author(s) References See Also Examples
These functions support response surface analysis with package rsm. Function rsmformula creates a model formula for use with function rsm, using the FO, TWI and PQ notation. Function code.design prepares a fractional factorial 2level design with center points from package FrF2 or a ccd, bbd or lhs design from this package for convenient use with package rsm functionality, function decode.design reverses the coding action.
1 2 3 4  code.design(design)
decode.design(design)
rsmformula(design, response=NULL, factor.names=NULL,
use.blockvar = TRUE, degree=2, coded=TRUE, ...)

design 
a response surface design of class 
response 
character string specifying the response variable to be analysed (default: the first response of the design) 
factor.names 
character vector specifying the factors to be included (default: all experimental factors) 
use.blockvar 
logical indicating whether or not the block effect (if available) is to be included into the model 
degree 
default is 2 for a full second order model.
For a first order only model, specify 1;
for a model with main effects and 2factor interactions, specify 1.5.

coded 
logical indicating whether the formula is to be provided in
coded names (x1, x2 etc., 
... 
reserved for future usage 
Function code.design
rescales the variables of a design with quantitative
variables according to the information stored in the coding
element of
the design.info
attribute of design
,
function decode.design
rescales a coded design to original units.
Function rsmformula
creates a formula for use with function rsm
.
If this function is created in coded variable names (which is the default),
it can be used in function rsm
together with the coded data object created by function code.design
for creating a response surface model, which can be postprocessed by the utilities provided
in package rsm, especially the [rsm:rsm]{methods}
for class rsm
objects
and functions steepest
or canonical.path
.
IMPORTANT: coded vs. original units
The text below assumes that the design has been entered using the default.levels
or the
factor.names
option to specify the factor levels in original units.
The usual steepest ascent analysis is done
in coded units, i.e. if e.g. factor X1 has original units 10 (code 1 = (1020)/10)
and 30 (code +1 = (3020)/10)
and factor X2 has original units 0.1 (code 1 = (0.1  0.2)/0.1)
and 0.3 (code +1 = (0.3  0.2)/0.1),
an increase of 10 for a change in factor X1 from 10 to 30 is considered
steeper (slope 10/2) than an increase of 9 for a change in factor X2
from 0.1 to 0.3 (slope 9/2). If this behavior is
desired, usage of rsmformula
with option coded=TRUE and a design generated
by code.design
is needed.
Otherwise, i.e. when assessment is desired
in original units, the ascent for factor X2 (9/0.2) would of course be much steeper
than for factor X1 (10/20) in the above example. For obtaining an assessment based
on the original units, one can simply use rsmformula
with option coded=FALSE
and the design itself in original units in the
rsm
model. This only makes sense for first order models:
function steepest
always assesses the slope at the origin;
for first order models, it does not matter where the slope is assessed. For models
with order (=degree
) 1.5 or 2, the steepest
analysis in original units
is adequate only for the exceptional case that 0 is the point of interest.
Function code.design
returns a coded.data
object
for usage with function rsm
; this object can be returned to its
original state by applying function decode.design
.
Function rsmformula
returns a formula with an FO
(=first order) portion,
for degree=1.5
additionally a TWI
(=two factor interactions, 2fis) portion,
and for degree=2
also a PQ
(=pure quadratic) portion.
This representation of the model formula is needed for response surface analyses
with package rsm. Per default, the formula comes
in coded variable names (x1
, x2
etc.).
This package is still under (slow) development. Reports about bugs and inconveniences are welcome.
Ulrike Groemping
Lenth, R.V. (2009). ResponseSurface Methods in R, using rsm. Journal of Statistical Software 32(7), 117. URLhttp://www.jstatsoft.org/v32/i07/.
Myers, R.H., Montgomery, D.C. and AndersonCook, C.M. (2009). Response Surface Methodology. Process and Product Optimization Using Designed Experiments. Wiley, New York.
See also rsm
,
steepest
, canonical.path
,
contour.lm
,
.
The formula
method for class design
objects
creates equivalent model formulae in standard model notation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71  ## an artificial example with random response
## purely for demonstrating how the functions work together with rsm
plan < ccd.design(5, ncenter=6,
factor.names = list(one=c(10,30),two=c(1,5),three=c(0.1,0.9),
four=c(2,4),five=c(1,1)))
set.seed(298)
plan < add.response(plan, rnorm(38))
## coding
plan.c < code.design(plan)
plan.c
decode.design(plan.c)
## first order analysis
## formulae needed for first order models:
rsmformula(plan, degree=1) ## coded
rsmformula(plan, degree=1, coded=FALSE) ## original units
## steepest ascent: steepness assessed in coded units,
## results also presented in original units
linmod1 < rsm(rsmformula(plan, degree=1), data=plan.c)
summary(linmod1)
steepest(linmod1)
## steepest ascent: steepness assessed in original units!!!
## this is different from the usual approach!!!
## cf. explanation in Details section
linmod1.original < rsm(rsmformula(plan, degree=1, coded=FALSE), data=plan)
summary(linmod1.original)
steepest(linmod1.original)
## second order analysis (including quadratic, degree=1.5 would omit quadratic
## formulae needed for second order models:
rsmformula(plan, degree=2) ## coded
rsmformula(plan, degree=2, coded=FALSE) ## original units
## the formulae can also be constructed analogously to the FO formulae
## by using SO instead of FO
## rsmformula returns the more detailed function because
## it can be more easily modified to omit one of the effects
## the stationary point is not affected by using coded or original units
## neither is the decision about the nature of the stationary point
## a subsequent canonical path analysis will however be affected,
## analogously to the steepest ascent (cf. Details section)
## analysis in coded units
linmod2 < rsm(rsmformula(plan, degree=2), data=plan.c)
summary(linmod2)
## analysis in original units
linmod2.original < rsm(rsmformula(plan, degree=2, coded=FALSE), data=plan)
summary(linmod2.original)
## the contour plot may be nicer when using original units
contour(linmod2, form=~x1*x2)
contour(linmod2.original, form=~one*two)
## the canonical path is usually more reasonable in coded units
canonical.path(linmod2) ## coded units
canonical.path(linmod2.original) ## original units
## analogous analysis without the special formula notation of function rsm
linmod < rsm(rnorm.38. ~ Block.ccd + (one + two + three + four + five)^2 +
I(one^2) + I(two^2) + I(three^2) + I(four^2) + I(five^2), data=plan)
summary(linmod)
contour(linmod, form=~one*two) ## contour plot is possible
## steepest or canonical.path cannot be used,
## because the model is a conventional lm
## contour will not work on the convenience model
## lm(plan), which is otherwise identical to linmod
## (it will neither work on lm(formula(plan), plan))
## or lm(rsmformula(plan), plan)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.