fac.layout {dae} | R Documentation |
Generate a layout for an experiment consisting of randomized factors that are randomized to the unrandomized factors, taking into account the nesting, for the design, between the unrandomized factors.
fac.layout(unrandomized, nested.factors=NULL, randomized, seed=NULL)
unrandomized |
a data frame or a list of factors (no numbers), along with their levels. If a list, the name of each component of the list is a factor name and the component is either a single numeric value that is the number of levels, a numeric vector that contains the levels of the factor or a character vector that contains the labels of the levels of the factor. |
nested.factors |
a list of the unrandomized factors that are nested in
other factors in unrandomized . The name of each
component is the name of a factor that is nested and
the component is a character vector containing the
factors within which it is nested. It is emphasized that
the nesting is a property of the design that is being
employed (it is only partly based on the intrinsic
nesting. |
randomized |
a factor or a data frame containing the values of the factor(s) to be randomized. |
seed |
a single value, interpreted as an integer, that specifies the starting value of the random number generator. |
This functon uses the method of randomization described by Bailey (1981). That is, a permutation of the units that respects the nesting for the design is obtained. This permutation is applied jointly to the unrandomized and randomized factors to produce the randomized layout. The Units and Permutation vectors enable one to swap between this permutation and the randomized layout.
A data frame consisting of the values for Units and Permutation vectors along with the values for the unrandomized and randomized factors that specify the randomized layout for the experiment.
Bailey, R.A. (1981) A unified approach to design of experiments. Journal of the Royal Statistical Society, Series A, 144, 214–223.
LS.unit <- data.frame(row = ordered(rep(c("I","II","III","IV"), times=4)), col = factor(rep(c(0,2,4,6), each=4))) LS.ran <- data.frame(treat = factor(c(1:4, 2,3,4,1, 3,4,1,2, 4,1,2,3))) data.frame(LS.unit, LS.ran) LS.lay <- fac.layout(unrandomized=LS.unit, randomized=LS.ran, seed=7197132) LS.lay[LS.lay$Permutation,] RCBD.unit <- list(rep = 2, plot=1:3, block = c("I","II")) RCBD.nest <- list(plot = c("block","rep"), block="rep") tr <- factor(rep(1:3, each=2, times=2)) RCBD.lay <- fac.layout(unrandomized=RCBD.unit, nested.factors=RCBD.nest, randomized=tr, seed=7197132) RCBD.perm <- RCBD.lay[RCBD.lay$Permutation,] RCBD.lay <- RCBD.perm[order(RCBD.perm$Units),]