View source: R/formula.design.R
formula.design | R Documentation |
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.
## S3 method for class 'design'
formula(x, ..., response=NULL, degree=NULL, FUN=NULL,
use.center=NULL, use.star=NULL, use.dummies=FALSE)
x |
an object of class |
... |
further arguments to function |
response |
character string giving the name of the response variable
(must be among the numeric columns from |
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 |
use.center |
|
use.star |
|
use.dummies |
logical indicating whether the error dummies of a Plackett Burman design are to be used in the formula (ignored for all other types of designs). |
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
1 for oa
and pb
2 for all other design types
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, the formula is the model formula used in optimizing the design.
a formula
Ulrike Groemping
See also formula
and lm.design
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.