Multcompare returning negative p values

6 views (last 30 days)
Sophie Dewil
Sophie Dewil on 11 Dec 2022
Commented: the cyclist on 12 Dec 2022
Hi all, I ran a four way anova using anovan and am trying to run post hoc tests using the variable "stats" from the anovan output. I've attached the mat file for the stats variable here. I'm running 'multcompare' using the code below and multiple of the interactions are returning negative p values. Any help you can provide with this would be greatly appreciated, thanks!!
[c,m,h,gnames] = multcompare(stats, "Dimension", [1 2])

Answers (1)

the cyclist
the cyclist on 12 Dec 2022
Note that the negative p-values are all tiny. I expect this is just round-off error.
% Load the data from the uploaded file
load(websave('stats','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1227552/stats.mat'));
% Run analysis
[c,m,h,gnames] = multcompare(stats, "Dimension", [1 2]);
% Display the negative p-values (6th column of c)
c(c(:,6)<0,6)
ans = 9×1
1.0e-07 * -0.4119 -0.4119 -0.4119 -0.4119 -0.4119 -0.4119 -0.4119 -0.4119 -0.4119
  2 Comments
Sophie Dewil
Sophie Dewil on 12 Dec 2022
Thank you so much for your answer! So are you thinking this is actually a legitimate answer and I can just assume these are very significant p values?
the cyclist
the cyclist on 12 Dec 2022
I think it is very unlikely that this is a MATLAB bug, but obviously true p-values cannot be negative. The fact that these are not only negative but also the same negative value suggests to me that maybe there is some level of approximation going on, and this is the result of that, round-off, etc.
In many contexts, I would be ok with quoting these p-values as p < 0.001. That being said, how diligently I followed up on this would also be dependent on context. For "mission critical" analyses, I would at least trace the calculations (using the debugger) to step into the multcompare function and see what is going on. (Sometimes you will be able to see the full calculation, and sometimes you will ultimately be thwarted by hitting something that is built-in and not visible to you.)

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!