フィルターのクリア

Multiple comparison test: hsd

11 ビュー (過去 30 日間)
Aniruddha Das
Aniruddha Das 2023 年 2 月 14 日
回答済み: Nihal 2024 年 9 月 25 日 10:17
Hello folks,
Question: whenever I am running a multiple comparison test (hsd) in more than two groups after performing an one-way ANOVA, the output always fixing one group as control dataset (marked in blue) and then plotting other groups (in red) and showing if it is sgnificant or not.
Is there any way where I can compare all groups to each other in a posthoc manner?
Thanks,

回答 (1 件)

Nihal
Nihal 2024 年 9 月 25 日 10:17
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
  1. Perform One-Way ANOVA: Use the anova1 function to perform one-way ANOVA.
  2. 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!

カテゴリ

Help Center および File ExchangeANOVA についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by