Here is my toy data
y = [1; 1; 2; 6; 7; 3];
and their group information is as follows
grp = ['a'; 'b'; 'b'; 'a'; 'c'; 'c'];
I perform the one-way ANOVA on it.
[~, ~, stats] = anova1(y, grp, 'off');
Then, I do a pairwise comparison with multcompare
[c, m, ~, gnames] = multcompare(stats);
Strangely, the group standard errors are the same!
disp('Mean and standard errors:');
disp([gnames num2cell(m)]);
Mean and standard errors:
'a' [3.5] [1.87082869338697]
'b' [1.5] [1.87082869338697]
'c' [ 5] [1.87082869338697]
How can this be possible?
I tried to compute standard errors manually myself. Surprisingly,
>> std(y(grp=='a'))/sqrt(sum(grp=='a'))
ans =
2.5
>> std(y(grp=='b'))/sqrt(sum(grp=='b'))
ans =
0.5
>> std(y(grp=='c'))/sqrt(sum(grp=='c'))
ans =
2