Dopt.design(nruns, data=NULL, formula=~., factor.names=NULL, nlevels=NULL,
digits=NULL, constraint=NULL, center=FALSE, nRepeats=5, seed=NULL, randomize=TRUE,
blocks=1, block.name="Blocks", wholeBlockData=NULL, ...)
data
is specified, factor.names
and levels
are ignoreddata
or elements or element names from factor.names
, respectively;
usage fac.design
, if data
is not specified. It is a
list of vectfactor.names
explicitly
lists all factor levels (which of course defines the number of levels).
For numeric factors for which factor.names
only specifies the
two scale ends, these ardata
is not specified.
It specifies the digits to which numeric design columns are rounded in case of
automatic creation of intermediate values. It can consist of one single value
(tconstraint
is evaluated on the specified data set or after automatic creation
of a full factorial candidate data set.TRUE
, the design (or the additional portion of the design) returned by the
workhorse function optF
nruns
must be divisible into blocks equally-sized blocks;
for optFederov
or optBlock
(if blocking is requested)
from package design
with attributes attached.
The data frame contains the experimental settings.
The matrix desnum
attached as attribute desnum
contains the
model matrix of the design, using the formula as specified in the call.
Function Dopt.augment
preserves additional variables (e.g. responses) that
have been added to the design design
before augmenting. Note, however, that
the response data are NOT used in deciding about which points to augment the design with.
The attribute run.order
provides the run number in standard order (as returned from
function optFederov
in package design.info
is a list of various design properties, with type resolving to design
), the element
quantitative
is a vector of nfactor
logical values or NAs,
and the optional digits
elements indicates the number of digits to
which the data were rounded.
For blocked and splitplot designs, the list contains additional information on numbers and sizes of blocks or plots,
as well as the number of whole plot factors (which are always the first few factors) and split-plot factors.
The list contains a list of optimality criteria as calculated by function optFederov
,
see documentation there)
with elements D
, Dea
, A
and G
.
(Note that replications
is always 1 and repeat.only
is always FALSE;
these elements are only present to fulfill the formal requirements for class design
.
Note however, that blocked designs do in fact repeat experimental runs if nruns
and blocks
imply this.)Dopt.design
creates a D-optimal design, optionally with blocking,
and even as a split-plot design. If no blocks are required, calculations are carried
out through function optFederov
from package optBlock
from package wholeBlockData
, a blocked design becomes
a split-plot design. The model formula can refer to both the within block data (only those
are referred to by the design
.
On the other hand, it sacrifices some of data
option, a full factorial in the
requested factors is the default candidate set of design points. For some situations - especially
with many factors - it may be better to start from a restricted candidate set. Such a candidate set
can be produced with another R function, e.g. oa.design
or FrF2
,
or can be manually created.
If there are doubts, whether the process has delivered a design close to the absolute optimum,
nRepeats
can be increased.
For unblocked designs, it is additionally possible to increase maxIteration
.
Also, improving the starting
value by nullify=1
or nullify=2
may lead to an improved design.
These options are handed through to function optFederov
from package optFederov
, fac.design
,
quad
, cubic
,
Dopt.augment
## a full quadratic model with constraint in three quantitative factors
plan <- Dopt.design(36,factor.names=list(eins=c(100,250),zwei=c(10,30),drei=c(-25,25)),
nlevels=c(4,3,6),
formula=~quad(.),
constraint="!(eins>=200 & zwei==30 & drei==25)")
plan
cor(plan)
y <- rnorm(36)
r.plan <- add.response(plan, y)
plan2 <- Dopt.augment(r.plan, m=10)
plot(plan2)
cor(plan2)
## designs with qualitative factors and blocks for
## an experiment on assessing stories of social situations
## where each subject is a block and receives a deck of 5 stories
plan.v <- Dopt.design(480, factor.names=list(cause=c("sick","bad luck","fault"),
consequences=c("alone","children","sick spouse"),
gender=c("Female","Male"),
Age=c("young","medium","old")),
blocks=96,
constraint="!(Age=="young" & consequences=="children")",
formula=~.+cause:consequences+gender:consequences+Age:cause)
## an experiment on assessing stories of social situations
## with the whole block (=whole plot) factor gender of the assessor
## not run for saving test time on CRAN
plan.v.splitplot <- Dopt.design(480, factor.names=list(cause=c("sick","bad luck","fault"),
consequences=c("alone","children","sick spouse"),
gender.story=c("Female","Male"),
Age=c("young","medium","old")),
blocks=96,
wholeBlockData=cbind(gender=rep(c("Female","Male"),each=48)),
constraint="!(Age==\"young\" & consequences==\"children\")",
formula=~.+gender+cause:consequences+gender.story:consequences+
gender:consequences+Age:cause+gender:gender.story)
Run the code above in your browser using DataLab