Hi Aniruddha,
In MATLAB, you can use the multcompare function to perform multiple comparisons of all group pairs after an ANOVA. This function will compare all groups to each other rather than fixing one group as a control.
Here’s how you can do it:
Step-by-Step Guide
- Perform One-Way ANOVA: Use the anova1 function to perform one-way ANOVA.
- Post-Hoc Test: Use the multcompare function to perform multiple comparisons.
% Example data
group1 = [23, 25, 27, 22, 24];
group2 = [32, 34, 31, 33, 35];
group3 = [45, 44, 46, 47, 43];
% Combine data into a single vector
data = [group1, group2, group3];
% Create a grouping variable
group = [ones(size(group1)), 2*ones(size(group2)), 3*ones(size(group3))];
% Perform one-way ANOVA
[p, tbl, stats] = anova1(data, group);
% Perform multiple comparisons using Tukey's HSD
figure;
[c, m, h, gnames] = multcompare(stats, 'CType', 'hsd');
% Display the results
disp('Multiple Comparisons Results:');
disp(c);
Hope it helps!