How to get real p value in the 'multicompare' output table instead of rounded number
5 次查看(过去 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.
0 个评论
采纳的回答
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
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 Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!