qua.design(design, quantitative = NA, contrasts = character(0), ...)
design
FALSE
;
the default character(0)
does not change any contrasts vs. the previous
or default contrasts.
For customizing, a named character vector can be given; the namdesign
; the element quantitative
of attribute design.info
,
the data frame itself and the desnum
attribute are modified as appropriate.contrasts
parameter.
The default contrasts for factors in class design
objects
(exception: purely quantitative design types like lhs or rsm designs)
depend on the number and content of levels:
2-level experimental factors are coded as R-factors with -1/1 contrasts,
experimental factors with more than two quantitative (=can be coerced to numeric) levels are
coded as R factors with polynomial contrasts (with scores the numerical levels of the factor),
and qualitatitve experimental factors with more than two levels are coded
as R factors with treatment contrasts.
Warning: It is possible to misuse this function especially for designs that have been
combined from several designs. For example, while setting factors in an lhs design to
qualitative is prevented, if the lhs design has been crossed with another design of a different
type, it would be possible to make such a nonsensical modification.## usage with all factors treated alike
plan <- oa.design(nlevels=c(2,6,2))
plan
plan <- qua.design(plan, quantitative = "none")
plan
plan <- qua.design(plan, quantitative = "all")
plan
plan <- qua.design(plan)
plan
## usage with individual factors treated differently
plan <- oa.design(factor.names = list(liquid=c("type1","type2"), dose=c(0,10,50,100,200,500), temperature=c(10,15)))
str(undesign(plan))
## would cause an error, since liquid is character and cannot be reasonably coerced to numeric
plan <- qua.design(plan, quantitative = "all")
plan <- qua.design(plan, quantitative = "none")
str(undesign(plan))
plan <- qua.design(plan, quantitative = c(dose=TRUE,temperature=TRUE))
str(undesign(plan))
## reset all factors to default
plan <- qua.design(plan, quantitative = NA)
str(undesign(plan))
desnum(plan)
## add a response
y <- rnorm(12)
plan <- add.response(plan,y)
## set dose to treatment contrasts
plan <- qua.design(plan, quantitative = c(dose=FALSE), contrasts=c(dose="contr.treatment"))
str(undesign(plan))
desnum(plan)
Run the code above in your browser using DataLab