I performed the one way ANOVA and multiple comparisons to deal with my data. But what's the statistical method of the function "multcompare"? Tukey's or Sidak's or ...

19 views (last 30 days)
I performed the one way ANOVA and multiple comparisons to deal with my data. But what's the statistical method of the function "multcompare"? Tukey's or Sidak's or ...

Accepted Answer

William Rose
William Rose on 12 Jan 2026 at 18:47
Edited: William Rose on 12 Jan 2026 at 19:19
[Edit: Correct spelling mistakes.]
multcompare() uses the Tukey-Kramer (also known as honestly significant difference) test by default. You can specify other statistical tests with the optional "CriticalValueType" parameter.
For example,
c = multcompare(stats,"CriticalValueType","bonferroni")
See here for a full list of options. Good luck with your analysis.
  1 Comment
William Rose
William Rose on 12 Jan 2026 at 19:04
Edited: William Rose on 12 Jan 2026 at 19:33
Example:
[Edit: I posted my initial comment before it was complete.]
Example:
  • Create simulated data set with three groups of 20 normally distributed values. The mean of group 2 is higher than groups 1 and 3.
  • Analyze the data with anova1().
  • If anova p<0.05, perform multple comparisons. Use the default statistics (Tukey-Kramer). Then repeat using Bonferroni statistics.
  • The confidence intervals (columns 3 and 5 of ans) and the p-values (column 6 of ans) for the multiple comparisons are slightly different for the different statistical methods.
rng(42); % for reproducibility of this example
y=randn(20,3)+repmat([0 1 0],20,1); % simulated data, three groups of 20
[p,~,stats]=anova1(y,[],'off'); % perform anova
if p<0.05
multcompare(stats,Display='off')
multcompare(stats,CriticalValueType='bonferroni',Display='off')
end
ans = 3×6
1.0000 2.0000 -1.6377 -0.8384 -0.0391 0.0378 1.0000 3.0000 -0.7865 0.0128 0.8121 0.9992 2.0000 3.0000 0.0519 0.8512 1.6505 0.0344
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
ans = 3×6
1.0000 2.0000 -1.6577 -0.8384 -0.0190 0.0432 1.0000 3.0000 -0.8065 0.0128 0.8322 1.0000 2.0000 3.0000 0.0319 0.8512 1.6705 0.0392
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!