Statistics Toolbox | ![]() ![]() |
Example: Multiple Comparisons
You can perform a multiple comparison test using the multcompare
function and supplying it with the stats
output from anova1
.
[c,m] = multcompare(stats) c = 1.0000 2.0000 2.4953 10.5000 18.5047 1.0000 3.0000 4.1619 12.1667 20.1714 1.0000 4.0000 6.6619 14.6667 22.6714 1.0000 5.0000 -2.0047 6.0000 14.0047 2.0000 3.0000 -6.3381 1.6667 9.6714 2.0000 4.0000 -3.8381 4.1667 12.1714 2.0000 5.0000 -12.5047 -4.5000 3.5047 3.0000 4.0000 -5.5047 2.5000 10.5047 3.0000 5.0000 -14.1714 -6.1667 1.8381 4.0000 5.0000 -16.6714 -8.6667 -0.6619 m = 23.8333 1.9273 13.3333 1.9273 11.6667 1.9273 9.1667 1.9273 17.8333 1.9273
The first output from multcompare
has one row for each pair of groups, with an estimate of the difference in group means and a confidence interval for that group. For example, the second row has the values
indicating that the mean of group 1 minus the mean of group 3 is estimated to be 12.1667, and a 95% confidence interval for this difference is [4.1619, 20.1714]. This interval does not contain 0, so we can conclude that the means of groups 1 and 3 are different.
The second output contains the mean and its standard error for each group.
It is easier to visualize the difference between group means by looking at the graph that multcompare
produces.
The graph shows that group 1 is significantly different from groups 2, 3, and 4. By using the mouse to select group 4, you can determine that it is also significantly different from group 5. Other pairs are not significantly different.
![]() | Multiple Comparisons | Two-Way Analysis of Variance (ANOVA) | ![]() |