This function calculates the adjusted values of the model and their standard errors for interactions between factors, at fixed values of covariates, if they exist. The main or crossed effect of covariates is represented by their “slope”, i.e. the variation rate of the response with respect to the product of the specified covariates. The default value of the covariates (and of the offset, if any) is their average in the model data frame, and it can be changed by the arguments covariates
or offset
, passed down to testFactors
. Note that in generalized linear models, standard errors and slopes are referred to the link function, not to the mean (see testFactors
for details, and how to force the calculation of the link function instead of the response for adjusted means).
In multivariate linear models, the adjusted means or slopes are calculated separately for each column by default, but it is possible to define an intra-subjects design of factors across columns, and put all columns in one. This may be defined by the argument idata
passed down to testFactors
(see Anova
or linearHypothesis
in package car for further details). If such transformation is done, it is also possible to include the factors of the intra-subjects design in factors
, for calculating their main effects or interactions.
The generic plot
function creates matrices of interaction plots, with the main effects of each factor represented in the diagonal, and the interactions between each pair of factors in the rest of panels. For multivariate models without intra-subjects design, a new device for each variable will be created. By default it also prints error bars around the means, plus/minus their standard errors. The size of the error bars can be adjusted by the argument errorbar
. Currently supported definitions are strings with the pattern ciXX
, where XX
is a number between 01 and 99, standing for the $XX
The adjusted means and error bars of generalized models (fitted with glm
or glmer
) are plotted on the scale of the link function, although the y-axis is labelled on the scale of the response (unless the link function had been forced in the calculation of the means).
If the interactions involve many factors, it may be convenient to plot each panel in a different device (with multiple=FALSE
), or select a subset of factors to be plotted with the arguments atx
and traces
. A panel will be plotted for each pair of factors defined by crossing these arguments; if the crossed factors are the same one, that panel will show its main effect.
By default, the interaction plots show the names of the factors on the labels of their x-axes (only for the bottom row of panels, if there is more than one). Those labels can be overriden by the argument xlab
, which should be a character vector with as many strings as the number of factors of the model (or the number of factors indicated in atx
). The string passed as ylab
will be used as the label of the y-axes on the left column of panels (no label is printed by default). The default main titles of the plots are the names of the dependent variables (e.g. "adjusted mean"), but they can be also replaced by a string passed in the argument main
, which will be used for all the variables if there is more than one.