I am trying to use Tukey's HSD test (Tukey's range test) from the multcompare function of the Statistics and Machine Learning Toolbox on MATLAB for the following purpose.
What I want to do: I have 3 groups of data (with different lengths) called G1, G2, and G3. I want to test whether means of each of these groups are equal. Most importantly (which is why I use Tukey's HSD test), I want to determine which of the pairwise differences in mean is statistically the most "real" difference. In other words, I want to determine which group out of the three has the most different mean than the others, and a critical value to help explain how different this one is. This is why I think what I should do is compare each of the three p value I get from Tukey's Test (three p values since there are three pairs to compare) to the "q-value" you get from Tukey's test. However, I do not know how to get this q value from the multcompare function in MATLAB?
My data are in column vectors, so I create one column vector for all of the data called D and one "label" vector as below called C.
labels1 = cell(length(G1), 1);
labels2 = cell(length(G2), 1);
labels3 = cell(length(G3), 1);
C = cat(1, labels1, labels2, labels3);
Now, I run anova1 to get the statistics.
[~, ~, stats] = anova1(D, C, "off");
Now, I run Tukey's HSD test using multcompare.
[results,means,~,gnames] = multcompare(stats,"CriticalValueType","hsd");
And finally, I will just format the results into a nice table (according to some sample code I found in example usage on the multcompare/anova1 pages).
tbl = array2table([results,means],"VariableNames", ...
["Group A","Group B","Lower Limit","A-B","Upper Limit","P-value","Mean","Standard Error"]);
tbl.("Group A")=gnames(tbl.("Group A"));
tbl.("Group B")=gnames(tbl.("Group B"))
So, this will give me a table with columns (in order): "Group A", "Group B", "Lower Limit", "A-B", "Upper Limit", "P-value", "Mean", and "Standard Error". There are three rows to this table (representing each combination of pairwise comparisons). I understand that the p-values in this table describe whether we can reject the null hypothesis that group means are the same with statistical significance, but now I need a q-value to compare them to. Does anyone know how to get this q value?