MATLAB Answers

Which pairwise hypothesis test is used on multcompare

23 views (last 30 days)
Reinder Dorman
Reinder Dorman on 3 Dec 2020
Edited: Ive J on 6 Dec 2020
HI All,
I have a feeling this question should be easily answered, so I suspect I might just be missing something.
On the function page of multcompare it aptly states that it performs the appropriate pairwise testing based on the stats input. But I'm trying to find what actual test is used. On the function page it keeps talking about a "hypothesis test", but I can't seem to find which actually test is being used.
In the "More about" section, it talks about t-tests, but I'm not sure if this isn't used as an example or if it means that is simply performs t-tests on the input (which would be performs on the the appropriate type of data, for instance on the ranks when using Kruskal-Wallis?).
Any help is greatly appreciated.


Ive J
Ive J on 3 Dec 2020
You can set the desired method using CType, default is Turkey's.
res = multcompare(ES, 'CType', 'dunn-sidak');
Reinder Dorman
Reinder Dorman on 3 Dec 2020
Hey Ive,
Thanks, but if I'm not mistaken, that is the multiple-comparison correction method used, which would affect the alpha for significance. But I don't think this is the actual test being used, right?
Ive J
Ive J on 5 Dec 2020
Yes it is correct. But the actual test being used depends on the background test; for instance a test like ANOVA would require a t-tes while a non-parametric ones like Kriskal-Wallis would requie a non-parametric one like Wilcoxon. Regardless, the function uses the means or meanranks from stat structure.
[~, ~, stats] = anova1(MPG, Origin, 'off')
stats =
struct with fields:
gnames: {6×1 cell}
n: [64 15 9 3 2 1]
source: 'anova1'
means: [21.1328 31.8000 28.4444 23.6667 22.5000 28]
df: 88
s: 7.0513
[~, ~, stats] = kruskalwallis(MPG, Origin, 'off')
stats =
struct with fields:
gnames: {6×1 cell}
n: [64 15 9 3 2 1]
source: 'kruskalwallis'
meanranks: [38.6719 75.2000 62.1111 49.3333 43.7500 67.5000]
sumt: 1266
You can check this further by
edit multcompare
So, you can realize that the function calculates critical values using tinv (t inverse CDF) for parametric tests (anova1 or anova2), while it uses norminv (normal inverse CDF) for non-parametric (KW or Friedman) ones.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by