Interactive analysis of covariance (ANCOVA)

aoctool

MATLAB makes it easy to perform analysis of covariance (ANCOVA) using an interactive tool. All it takes to test-drive this tool is a one-liner…

    load carsmall; aoctool(Weight, MPG, Model_Year);

This will generate three windows:

  • An interactive graph of the data and prediction curves
  • An ANOVA table
  • A table of parameter estimates

aoctool(x,y,group) fits a separate line to the column vectors, x and y, for each group defined by the values in the array group. group may be a categorical variable, numeric vector, character array, string array, or cell array of character vectors. These types of models are known as one-way ANOCOVA models.

You can then perform a multiple comparison tests directly from the stats output structure from aoctool as input to the multcompare function, which opens another interactive interface…

    [h, a, c, stats] = aoctool(Weight,MPG,Model_Year,0.05);
[c, se, h, g] = multcompare(stats);

This will display an interactive graph of the estimates and comparison intervals. Two group means are significantly different if their intervals are disjoint; they are not significantly different if their intervals overlap. If you use your mouse to select any group, then the graph will highlight all other groups that are significantly different, if any.

[c,se,h,g] = multcompare(stats) returns…

  • c  :  the pairwise comparison results from a multiple comparison test using the information contained in the stats structure.
  • se   :  a matrix of estimated values of the means for each group and the corresponding standard errors.
  • h  :  a handle to the comparison graph
  • g  :  a cell array that contains the names of each group