Plotting class design objects | R Documentation |
The plot method for class design objects; other methods are part of a separate help page.
## S3 method for class 'design'
plot(x, y=NULL, select=NULL, selprop=0.25, ask=NULL, ...)
x |
data frame of S3 class |
y |
a character vector of names of numeric variables in |
select |
Specification of selected factors through option |
selprop |
a number between 0 and 1 indicating which proportion of
worst cases to plot in case |
ask |
a logical; |
... |
further arguments to functions |
Items of class design
are data frames with attributes,
that have been created for conducting experiments. Apart from the plot method
documented here, separate files document the methods formula.design
,
lm.design
, and further methods
.
The method for plot
calls the method available in package graphics
(see plot.design
) wherever this makes sense (x
not of class design
,
x
of class design
but not following the class design
structure
defined in package DoE.base,
and x
a design with all factors being R-factors and at least one response available).
Function plot.design
from package graphics is not
an adequate choice for designs without responses or designs with experimental factors
that are not R-factors.
For designs with all factors being R-factors and no response defined (e.g. a freshly-created
design from function oa.design
), function plot.design
creates a mosaic plot of
the frequency table of the design, which may be quite useful to understand the structure
for designs with relatively few factors (cf. example below; function plot.design
calls
function mosaic
for this purpose). It will generally be necessary to specify the select
argument, if the design is not very small. If select
is not specified although there are more than four factors, select=1:4
is chosen as the default.
For designs with at least one experimental factor that is not an R-factor, function
plot.design
calls function plot.data.frame
in order
to create a scatter plot matrix.
Currently, there is no good method for plotting designs with mixed qualitative
and quantitative factors.
If option select
is set to "all2"
, "all3"
or "all4"
,
or a list with a numeric vector as its first element and one of these as the second element,
or with select
as any of "complete"
, "worst"
, "worst.rel"
,
"worst.parft"
or "worst.parftdf"
,
response variables are ignored, and mosaic plots are created.
These requests usually ask for several plots; note that the plots are
created one after the other; with an interactive graphics device, the default is that they overwrite each other
after a user confirmation for the next plot, which allows users to visually inspect them one at a time;
under Windows, the plotting series can be aborted using the Esc
-key.
With non-interactive graphics devices,
the default is ask=FALSE
(e.g. for storing all the plots
in a multi-page file, see examples).
If option select
is any of "all2"
, "all3"
or "all4"
,
mosaic plots of all pairs, triples or quadruples of factors are created as specified.
Note that "all2"
is interesting for non-orthogonal designs only, e.g. ones created by function Dopt.design
.
If option select
is set to "complete"
, "worst"
"worst.rel"
,
"worst.parft"
or "worst.parftdf"
,
the worst case tuples to be displayed are selected by function tupleSel
.
The plot
method is called for its side effects and returns NULL
.
The package is currently subject to intensive development; most key functionality is now included. Some changes to input and output structures may still occur.
Ulrike Groemping
Groemping, U (2014) Mosaic plots are useful for visualizing low order projections of factorial designs. To appear in The American Statistician https://www.tandfonline.com/action/showAxaArticles?journalCode=utas20.
See also the following functions known to produce objects of class
design
: FrF2
, pb
, fac.design
, oa.design
,
and function plot.design
from package graphics;
a method for function lm
is described in the separate help file
lm.design
.
#### Examples for plotting designs
oa12 <- oa.design(nlevels=c(2,2,6))
## plotting a design without response (uses function mosaic from package vcd)
plot(oa12)
## equivalent to mosaic(~A+B+C, oa12)
## alternative order: mosaic(~C+A+B, oa12)
plot(oa12, select=c(3,1,2))
## using the select function: the plots show that the projection for factors
## C, D and E (columns 3, 14 and 15 of the array) is a full factorial,
## while A, D and E (columns 1, 14, and 15 of the array) do not occur in
## all combinations
plan <- oa.design(L24.2.13.3.1.4.1,nlevels=c(2,2,2,3,4))
plot(plan, select=c("E","D","A"))
plot(plan, select=c("E","D","C"))
## Not run:
plot(plan, select="all3")
plot(plan, select=list(c(1,3,4,5), "all3"))
## use the specialist version of option sub
plot(plan, select=list(c(1,3,4,5), "all3"), sub="A")
## create a file with mosaic plots of all 3-factor projections
pdf(file="exampleplots.pdf")
plot(plan, select="all3", main="Design from L24.2.13.3.1.4.1 in default column order)")
plot(plan, select="worst", selprop=0.3, sub="A")
dev.off()
## the file exampleplots.pdf is now available within the current working
## directory
## End(Not run)
## plotting a design with response
y=rnorm(12)
plot(oa12, y)
## plot design with a response included
oa12.r <- add.response(oa12,y)
plot(oa12.r)
## plotting a numeric design (with or without response,
## does not make statistical sense here, for demo only)
noa12 <- qua.design(oa12, quantitative="all")
plot(noa12, y, main="Scatter Plot Matrix")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.