interactionplot - Interaction plot for grouped data

Syntax

interactionplot(Y,GROUP)
interactionplot(Y,GROUP,'varnames',VARNAMES)
[h,AX,bigax] = interactionplot(...)

Description

interactionplot(Y,GROUP) displays the two-factor interaction plot for the group means of matrix Y with groups defined by entries in the cell array GROUP. Y is a numeric matrix or vector. If Y is a matrix, the rows represent different observations and the columns represent replications of each observation. If Y is a vector, the rows give the means of each entry in the cell array GROUP. Each cell of GROUP must contain a grouping variable that can be a categorical variable, numeric vector, character matrix, or a single-column cell array of strings. (See Grouped Data.) GROUP can also be a matrix whose columns represent different grouping variables. Each grouping variable must have the same number of rows as Y. The number of grouping variables must be greater than 1.

The interaction plot is a matrix plot, with the number of rows and columns both equal to the number of grouping variables. The grouping variable names are printed on the diagonal of the plot matrix. The plot at off-diagonal position (i,j) is the interaction of the two variables whose names are given at row diagonal (i,i) and column diagonal (j,j), respectively.

interactionplot(Y,GROUP,'varnames',VARNAMES) displays the interaction plot with user-specified grouping variable names VARNAMES. VARNAMES is a character matrix or a cell array of strings, one per grouping variable. Default names are 'X1', 'X2', ... .

[h,AX,bigax] = interactionplot(...) returns a handle h to the figure window, a matrix AX of handles to the subplot axes, and a handle bigax to the big (invisible) axes framing the subplots.

Example

Display interaction plots for data with four 3-level factors named 'A', 'B','C', and 'D':

y = randn(1000,1); % response
group = ceil(3*rand(1000,4)); % four 3-level factors
interactionplot(y,group,'varnames',{'A','B','C','D'})

See Also

maineffectsplot, multivarichart

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS