formula.design {DoE.base}R Documentation

Function to change the default formula for a data frame of class design to involve the correct factors with the desired effects and responses

Description

This function provides a reasonable default formula for linear model analyses of class design objects with response(s). Per default, the resulting formula refers to the first response in the design and is of design-type specific nature.

Usage

## S3 method for class 'design':
formula(x, ..., response=NULL, degree=NULL, FUN=NULL, 
      use.center=TRUE)

Arguments

x an object of class design
... further arguments to function formula
response character string giving the name of the response variable (must be among the numeric columns from x)
OR
integer number giving the position of the response in element response.names of attribute design.info
degree degree of the model (1=main effects only, 2=with 2-factor interactions and quadratic effects, 3=with 3-factor interactions and up to cubic effects, ...
FUN function for the aggregate.design method; this must be an unquoted function name or NULL;
This option is relevant for repeated measurement designs and parameter designs in long format only
use.center logical indicating whether center points are to be used + in the analysis; relevant for pb and FrF2 designs with center points only

Details

Function formula creates an appropriate formula for many kinds of objects, e.g. for data frames (try e.g. formula(swiss)). Function as.formula uses function formula, but cannot take any additional arguments.

The method for class design objects modifies the way a data frame would normally be treated by the formula function. This also carries through to default linear models.

Without the additional arguments, the function creates the formula with the first response from the response.names element of the design.info attribute. The default degree depends on the type of design: it is

degree does not have an effect for response surface designs (types bbd, bbd.blocked and ccd) and latin hypercube designs (type lhs), where the function always creates the formula for a full second order model including quadratic effects.

Where degree does have an effect, it is the exponent of the sum of all experimental factors, i.e. it refers to the degree of interactions, not to powers of the variables themselves (e.g. (A+B+C)^2 for degree 2).

For designs with a block variable (types FrF2.blocked, bbd.blocked and ccd) the block variable enters the formula as a main effect factor without any interactions.

For 2-level designs with center points (types FrF2.center or pb.center), the formula contains an indicator variable center for the center points that can is used for checking whether quadratic effects are needed.

For designs with repeated measurements (repeat.only and parameter designs, the default is to analyse aggregated responses. For more detail, see the documentation of lm.design.

For optimal designs (not implemented yet), the formula will be the model formula used in optimizing the design.

Value

a formula

Author(s)

Ulrike Groemping

See Also

See also formula and lm.design

Examples

  ## indirect usage via function lm.design is much more interesting
  ## cf help for lm design!

   my.L18 <- oa.design(ID=L18, 
       factor.names = c("one","two","three","four","five","six","seven"), 
       nlevels=c(3,3,3,2,3,3,3))
   y <- rnorm(18)
   my.L18 <- add.response(my.L18, y)
   formula(my.L18)
   lm(my.L18)

[Package DoE.base version 0.9-14 Index]