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

14 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

dpb
dpb le 18 Fév 2021
Modifié(e) : dpb le 18 Fév 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 commentaires
dpb
dpb le 18 Fév 2021
+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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Workspace Variables and MAT-Files dans Help Center et File Exchange

Produits


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by