Next: interblock() Up: Design Macros Help File Previous: findsampsize()   Contents

interactplot()

Usage:
interactplot(y,a [,b,c ...] [errors:T or errors:x,pool:T|F,errorvar:v]
  [graphics keywords]), y a REAL vector, a, b, c, ... vectors of positive 
  integers the same length as y, x and v positive scalars.
interactplot(means [errors:T or errors:x,errormat:s] [graphics 
  keywords]), means a REAL matrix or array,x a positive scalar, s a
  positive matrix the same shape as means.
interactplot(a [,b,c ...],frommodel:T,[errors:T or errors:x] [graphics 
  keywords]), a, b, c, ... factors in the current model, x a positive
  scalar.



Keywords: factorial, plots
                             Usage_with_data
interactplot(y,a [,b,c ...] [graphics keywords]) makes an interaction
plot of the marginal means of REAL vector y for all combinations of
variables a, b, c, ....  The variables a, b, ... must be vectors of
positive integers the same length as y.

The levels of variable a will be put on the horizontal axis and separate
lines drawn for each combination of variables values of b, c, ....  When
a is the only factor argument, only one line is drawn.  Lines are
numbered lb.lc.ld ... with lx denotine the level of factor x.

                            Usage_with_means
interactplot(means [graphics keywords]) where means is a REAL matrix or
array will make an interaction plot with the first dimension of means on
the horizontal axis, and separate lines for each combination of the
other dimensions.  The lines are numbered 1, 2, 3, ...  with the last
dimension varying slowest.  interactplot(tabs(y,a,b,means:T)) makes the
same plot as interactplot(y,a,b).

                            Usage_with_models
interactplot(a[,b,c ...],frommodel:T [graphics keywords]) makes an
interaction plot of the least squares means of the term a.b.c ...
from the most recent glm model.  This is similar to doing a plot of
the matrix glmtable(a,b,c,estimate:T,seest:F).  NOTE: because this
usage involves glmtable(), it will not work for balanced anova()
models unless unbal:T was used as an argument.

                            Usage_with_errors
Use of the argument errors:T or errors:x cause interactplot to draw
error bars around each mean (and slightly offset the horizontal
plotting positions).  errors:T is equivalent to errors:2, meaning
that the bars should be plus or minus two standard errors. errors:x
will plot bars that are plus or minus x standard errors.

When errors:T is used with frommodel:T, errors for the LS means are
determined from the model via glmtable().

When errors:T is used with a matrix of means, you must specify the
standard errors via errormat:s, where s is a real matrix of the same
shape as the means.

When errors:T is used with data and splitting factors, the standard
errors are computed as the square root of a variance divided by the
number of data elements in each mean.  By default, a separate variance
is estimated from the data used for each mean.  Use of pool:T pools
all of the variance estimates into a single estimate of variance.
Use of errorvar:v causes v to be used as the variance for all means,
regardless of the variability in the data.

                            Graphics keywords
In both usages, any graphics keywords will be passed to function
chplot() which actually makes the plot.  In particular, for example,

  Cmd> interactplot(y,a,b,symbols:vector("B1","B2","B3"),\
        xticklabs:vector("A1","A2","A3","A4"))

will label the curves B1, B2 and B3 instead of 1, 2 and 3 and the
horizontal axis location A1, A2, A3 and A4.


Gary Oehlert 2005-08-12