Function getblock creates block factors for designs with replications, repeated measurements or split plot designs. Function rerandomize.design rerandomizes an experimental design.
an object of class
logical with default
integer number for initialization of the random number generator
(needed for repeatable rerandomization)
character string giving the name of a block factor (only for unreplicated
designs that do not have any prior blocking or split plot structure;
meant for block randomization of designs created with function
currently not used
The purpose of function
getblock is to support users in doing their own analyses
accomodating randomization restrictions like blocking and split plotting
with R modeling functions.
The reason for including designs with proper replications is that these are randomized in blocks by packages DoE.base and FrF2 and partly by DoE.wrapper. While the package author does not consider it generally necessary to analyze these with a block factor, function getblock makes it easy for users with a different opinion (or for situations for which time turns out to be important in spite of not having explicitly blocked for time) to run an analysis with a block factor for the replication.
For unreplicated split plot designs, a whole plot identifier is returned; the design itself contains the plot information via the settings of the whole plot factors only. Thus, it may be useful to be able to create the plot identifier.
For replicated block or split plot designs, there is a randomization hierarchy that will depend on how the experiment was actually conducted. Therefore, a dataframe is generated the columns of which can be used in the appropriate way by a statistically literate user.
rerandomize.design rerandomizes a design. This can be useful if
the user wants to obtain unblocked replications (packages
DoE.base and FrF2
usually randomize in blocks on time) or wants to freely randomize the center point
position over the whole range of the experiment (or a block, respectively),
or if the user wants to also randomize the
blocks (rather than randomizing the block units to the experimental blocks
outside of the design),
or if the user wants to do block randomization on a block factor specified with
for a design created with function
pb (which do not offer
explicit specification of blocking).
It can also be useful for ensuring a randomization that has little correlation between run order and model matrix columns; this correlation can e.g. be checked with the help of function
corrPlot, using the option
a single factor with block information (for split plot designs without replication or replicated designs without randomization restrictions)
or a data frame with several blocking factors (for designs with randomization restrictions and replication).
rerandomize.design returns a class
note that it will not be possible to add center points after re-randomization,
i.e. if required, center points have to be added before using the function.
Since R version 3.6.0, the behavior of function
sample has changed
(correction of a biased previous behavior that should not be relevant for the randomization of designs).
For reproducing a re-randomization that was produced with an earlier R version,
please follow the steps described with the argument
1 2 3 4 5 6 7 8 9 10 11 12
## a blocked full factorial design ff <- fac.design(nlevels=c(2,2,2,3,3,3), blocks=6, bbrep=2, wbrep=2, repeat.only=FALSE) getblock(ff) getblock(ff, combine=TRUE) rerandomize.design(ff) ff <- fac.design(nlevels=c(2,2,2,3,3,3), replications=2, repeat.only=FALSE) getblock(ff) ff <- fac.design(nlevels=c(2,2,2,3,3,3), replications=2, repeat.only=FALSE) try(getblock(ff)) ## a design created with oa.design small <- oa.design(nlevels=c(2,2,2,2,2,2,2,2,8)) rerandomize.design(small, block="J")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.