MATLAB Answers

How to get real p value in the 'multicompare' output table instead of rounded number

15 views (last 30 days)
Sang Hoon Kim
Sang Hoon Kim on 18 Feb 2021
Edited: dpb on 18 Feb 2021
Dear
I would like to get real p value in the 'multicompare' output table instead of rounded number.
For example,
[p,table,stats] = kruskalwallis(data,groups);
From my data, I got 2.478874278408479e-29 for p-value. (which is good.)
Then, I used multicompare function.
[c,m,h,nms] = multcompare(stats,'alpha',.05,'ctype','dunn-sidak');
1 2 107.358736884486 149.713883016209 192.069029147931 0
1 3 120.836759163490 153.690374387319 186.543989611148 0
2 3 -32.2920513577527 3.97649137111020 40.2450340999731 0.991192034848183
here is the result for c, and 6th column would be p value.
For group1-group2 comparison, I got '0' for p-value.
I wonder if I could get real value(ex) format like 2.54 x 10-29 ) instead of just 0 (rounded number)
I really appreciate it if someone could help.

Accepted Answer

dpb
dpb on 18 Feb 2021
Edited: dpb on 18 Feb 2021
As Walter points out beflow, that it prints an integer zero indicates the calculation of the p-value underflowed and the returned value was identically zero.
If it's a case of lack of precision on the command window, you can do something like:
fmt=['%5d%5d' repmat('%12.4f',1,3) '%12.3e\n'];
fprintf(fmt,c.')
In this case the values would be displayed 0.0000 if in format short mode, format long would give 15 digits but E-29 would still have underflowed.
  3 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!