panel.interaction2wt: Plot all main effects and twoway interactions in a... In HH: Statistical Analysis and Data Display: Heiberger and Holland

Description

This is the panel function for interaction2wt. 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.

Usage

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 panel.interaction2wt(x, y, subscripts, responselab, trace.values, factor.levels, factor.position, fun = mean, se, type="l", ..., box.ratio, simple=FALSE, simple.offset, simple.scale, simple.pch, data.x, col.by.row=TRUE, key.in=NULL) strip.interaction2wt(which.given, which.panel, var.name, factor.levels, shingle.intervals, strip.names = c(TRUE, TRUE), style = 1, ...) 

Arguments

panel.interaction2wt arguments:

 x levels of x-factor y Summary value of response variable at each level of x- and trace-factors. subscripts used to get the right set of response values for the summary statistics on the off-diagonals responselab Character name of response variable, defaults to the name of the response variable. trace.values levels of trace-factor fun Summary function, defaults to mean se standard errors to be passed to panel.intxplot. Missing, logical, or a numeric vector. If se is missing or FALSE, or if simple is FALSE, then standard errors are not plotted. If TRUE, the standard errors are calculated from the sufficient statistics for each group as the group's standard deviation divided by the square root of the group's observation count. If a numeric vector, it is evaluated in the environment of the sufficient statistics.

,

 type See panel.xyplot.

,

 box.ratio passed to panel.bwplot.intermediate.hh

,

 ... extra arguments, primarily color, to be passed to panel.bwplot.intermediate.hh key.in S-Plus only. Arguments to be passed through to the key for the trace-factor in each row of the display. The most likely argument is x, which is needed if the key is not correctly placed. Use, for example, key.in=list(x=-3.5) where the units are the units of the left column of panels and the value is the location where the left border of the key should be placed. factor.position "position" attribute of factor. simple logical. If TRUE, then simple effects are to be displayed. simple.offset, simple.scale named list of offset and scale for the response and trace factors. See interaction.positioned for their use. simple.pch Named list containing plotting characters for each level of one or more of the factors. simple.pch is used only when simple==TRUE. If the argument simple.pch is missing, then the integers for the levels of the factors are used. The characters are used for the median of the box plots in the diagonal panels. They match the trace factor of the interaction panel in the same column of the display. data.x data.frame containing factors from the input data.frame col.by.row logical. If TRUE (the default), simple effects plots color the simple effects on the main diagonals in the same color as the trace levels in their row. If FALSE, then simple effects are colored to match the x levels in their column.

strip.interaction2wt arguments

 which.given, which.panel, var.name, factor.levels, shingle.intervals see documentation for strip.default

.

 strip.names Force strip.names=TRUE style force style=1

Author(s)

Richard M. Heiberger <rmh@temple.edu>

References

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://www.springer.com/us/book/9781493921218

interaction2wt, panel.bwplot.intermediate.hh

Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 ## Not run: tmp <- data.frame(y=rnorm(48), A=factor(rep(1:2, 24)), B=factor(rep(rep(1:3, each=2), 8)), C=factor(rep(rep(1:4, each=6), 2))) interaction2wt(y ~ A+B+C, data=tmp, key.in=list(x=-3), ## key.in is ignored by R xlim=c(.4, 4.5)) interaction2wt(y ~ B+C, data=tmp, key.in=list(x=-2), xlim=c(.4, 4.5)) position(tmp\$B) <- c(1, 2.4, 3.8) interaction2wt(y ~ B+C, data=tmp, key.in=list(x=-2), xlim=c(.4, 4.5)) interaction2wt(y ~ B+C, data=tmp, simple=TRUE, simple.scale=list(B=.18, C=.27), box.ratio=.2, key.in=list(x=-2), xlim=c(.4, 4.5)) interaction2wt(y ~ C+B, data=tmp, simple=TRUE, simple.scale=list(B=.18, C=.27), box.ratio=.2, key.in=list(x=-2), xlim=c(.4, 4.5)) interaction2wt(y ~ B+C, data=tmp, simple=TRUE, simple.scale=list(B=.18, C=.27), box.ratio=.2, simple.pch=list(C=c(16,17,18,19)), key.in=list(x=-2), xlim=c(.4, 4.5)) interaction2wt(y ~ C+B, data=tmp, simple=TRUE, simple.scale=list(B=.18, C=.27), box.ratio=.2, simple.pch=list(C=c(16,17,18,19)), key.in=list(x=-2), xlim=c(.4, 4.5)) interaction2wt(y ~ C+B, data=tmp, simple=TRUE, simple.scale=list(B=.18, C=.27), box.ratio=.2, simple.pch=list(A=c(1:2), B=c(3:5), C=c(16,17,18,19)), key.in=list(x=-2), xlim=c(.4, 4.5)) interaction2wt(y ~ C+B, data=tmp, simple=TRUE, simple.scale=list(B=.18, C=.27), box.ratio=.2, simple.pch=list(A=c(1:2)), key.in=list(x=-2), xlim=c(.4, 4.5)) interaction2wt(y ~ B+C, data=tmp, simple=TRUE, simple.scale=list(B=.18, C=.27), box.ratio=.2, simple.pch=list(B=c(16,17,18)), key.in=list(x=-2), xlim=c(.4, 4.5), se=TRUE) ## End(Not run) 

Example output

Loading required package: lattice

Attaching package: 'TH.data'

The following object is masked from 'package:MASS':

geyser

Warning message:
In rep(pch, length = length(fac.levels)) :
'x' is NULL so the result will be NULL
Warning message:
In rep(pch, length = length(fac.levels)) :
'x' is NULL so the result will be NULL
Warning messages:
1: In rep(pch, length = length(fac.levels)) :
'x' is NULL so the result will be NULL
2: In rep(pch, length = length(fac.levels)) :
'x' is NULL so the result will be NULL
Warning message:
In rep(pch, length = length(fac.levels)) :
'x' is NULL so the result will be NULL


HH documentation built on Nov. 28, 2020, 9:06 a.m.