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

16 次查看(过去 30 天)
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.

采纳的回答

dpb
dpb 2021-2-18
编辑:dpb 2021-2-18
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 个评论
dpb
dpb 2021-2-18
+1, Walter. He's got p-values small enough to have underflowed the calculation engine, you're right.
I just took a sample from one of the Examples but it isn't identically zero, correct.
I'll make note to the Answer.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by