View source: R/interaction2wt.R
interaction2wt | R Documentation |
The main diagonal
displays boxplots for the main effects of each factor. The
off-diagonals show the interaction plots for each pair of factors.
The i,j
panel shows the same factors as the j,i
but with
the trace- and x-factor roles interchanged.
interaction2wt(x, ...)
## S3 method for class 'formula'
interaction2wt(x, data=NULL, responselab, ...)
## Default S3 method:
interaction2wt(x,
response.var,
responselab = deparse(substitute(response.var)),
responselab.expression = responselab,
relation = list(x = "same", y = "same"),
x.relation = relation$x,
y.relation = relation$y,
digits = 3,
x.between=1,
y.between=1,
between,
cex = 0.75,
rot=c(0,0),
panel.input = panel.interaction2wt,
strip.input =
if (label.as.interaction.formula) strip.default
else strip.interaction2wt,
par.strip.text.input = trellis.par.get()$add.text,
scales.additional,
main.in =
paste(responselab,
": ", c("main", "simple")[1+simple],
" effects and 2-way interactions",
sep=""),
xlab = "",
ylab = "",
simple=FALSE,
box.ratio=if (simple) .32 else 1,
label.as.interaction.formula=TRUE,
...,
main.cex,
key.cex.title=.8,
key.cex.text=.7,
factor.expressions=names.x,
simple.pch=NULL,
col.by.row=TRUE,
col =trellis.par.get("superpose.line")$col,
lty =trellis.par.get("superpose.line")$lty,
lwd =trellis.par.get("superpose.line")$lwd,
alpha=trellis.par.get("superpose.line")$alpha
)
Arguments when x
is a formula.
x |
The object on which method dispatch is carried out. For the For the |
data |
For the |
responselab |
Character name of response variable, defaults to
the name of the response variable in the |
responselab.expression |
|
... |
additional arguments, primarily trellis arguments. |
response.var |
For the |
simple |
logical. |
box.ratio |
|
Trellis/Lattice arguments. Default values are set by the
the formula
method. The user may override the defaults.
See also
xyplot
.
relation |
|
x.relation |
|
y.relation |
|
digits |
doesn't do anything at the moment |
x.between |
|
y.between |
|
between |
trellis/lattice |
cex |
S-Plus: changes the size of the median dot in the boxplots. R: doesn't do anything. |
panel.input |
panel function. Default is |
label.as.interaction.formula |
logical. If |
strip.input |
strip function. Default depends on the value of
|
par.strip.text.input |
|
scales.additional |
additional arguments to |
main.in |
Text of main title. |
xlab |
No effect. |
ylab |
No effect. |
main.cex |
|
key.cex.title |
|
key.cex.text |
|
factor.expressions |
Expressions for titles of keys and
|
rot |
Rotation of x tick labels and y tick labels. Only 0 and 90 will look good. |
simple.pch |
Named list containing plotting characters for each
level of one or more of the factors. |
col.by.row |
logical. If |
col , lty , lwd , alpha |
Arguments to
|
"trellis"
object containing the plot.
Richard M. Heiberger <rmh@temple.edu>
Heiberger, Richard M. and Holland, Burt (2015). Statistical Analysis and Data Display: An Intermediate Course with Examples in R. Second Edition. Springer-Verlag, New York. https://link.springer.com/book/10.1007/978-1-4939-2122-5
panel.interaction2wt
data(vulcan)
interaction2wt(wear ~ filler + pretreat + raw, data=vulcan,
par.strip.text=list(cex=.7))
interaction2wt(wear ~ filler + pretreat + raw, data=vulcan,
par.strip.text=list(cex=.7),
label.as.interaction.formula=FALSE)
interaction2wt(wear ~ filler + raw, data=vulcan,
simple=TRUE)
interaction2wt(wear ~ filler + raw, data=vulcan,
simple=TRUE, col.by.row=FALSE)
interaction2wt(wear ~ filler + raw, data=vulcan,
simple=TRUE, simple.scale=c(filler=.15, raw=.2),
xlim=c(.3, 5.6))
interaction2wt(wear ~ filler + raw, data=vulcan,
col=1:5, lwd=1:5, lty=1:5)
interaction2wt(wear ~ filler + raw, data=vulcan,
simple=TRUE, col=1:5, lwd=1:5, lty=1:5)
interaction2wt(wear ~ filler + raw, data=vulcan,
simple=TRUE, col=1:5, lwd=1:5, lty=1:5, col.by.row=FALSE,
simple.pch=list(filler=LETTERS[1:5], raw=letters[6:9]), cex=2)
ToothGrowth$dose <- positioned(ToothGrowth$dose) ## modify local copy
anova(aov(len ~ supp*dose, data=ToothGrowth))
interaction2wt(len ~ supp + dose, data=ToothGrowth)
esoph$ntotal <- with(esoph, ncases + ncontrols) ## modify local copy
esoph$rate <- with(esoph, ncases/ntotal) ## modify local copy
position(esoph$alcgp) <- 2:5
position(esoph$tobgp) <- 2:5
interaction2wt(rate ~ agegp + alcgp + tobgp, esoph, rot=c(90,0),
par.strip.text=list(cex=.8))
interaction2wt(rate ~ agegp + alcgp + tobgp, esoph, rot=c(90,0),
par.strip.text=list(cex=.8),
factor.expressions=c(
agegp=expression(Age~~(years)),
alcgp=expression(Alcohol~
bgroup("(",scriptstyle(frac(gm, day)),")")),
tobgp=expression(Tobacco~
bgroup("(",scriptstyle(frac(gm, day)),")"))),
par.settings=list(
par.xlab.text=list(cex=.8),
par.ylab.text=list(cex=.8)),
responselab.expression="Cancer\nRate",
main=list(
"Esophogeal Cancer Rate ~ Alcohol Consumption + Tobacco Consumption",
cex=1.2))
esoph.aov <- aov(rate ~ agegp + alcgp + tobgp, data=esoph)
anova(esoph.aov)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.