- Small sample sizes: With small sample sizes, the assumptions of the statistical test might not be fully met, which could lead to issues with the calculation of the p-values. However, this is less likely to be the problem since the Tukey-Kramer method works fine.
- Zero variance or identical groups: If one or more groups have zero variance (i.e., all values in a group are identical), the Bonferroni method may fail to compute the p-values properly.
multcompare function: p-values are NaN if bonferroni method is used
3 次查看(过去 30 天)
显示 更早的评论
Dear Community,
I have datasets from four groups with sizes of n = 39, n = 15, n = 63, n = 10 and compare these via kruskalwallis yielding p = 0.012. I then attempt post hoc tests (bonferroni method) using the multcompare function as can be seen below. The respective column featuring the p-values displays NaN only. Why is that? When I do not use bonferroni method, but the default option (tukey-kramer) does not result in this problem.
Thank you in advance,
Hannah
z_data = [caps_z; atax_z; dys_z; all_z];
z_group = [ones(size(caps_z)); 2 * ones(size(atax_z));3 * ones(size(dys_z));4 * ones(size(all_z))];
[zP,zANOVATAB,zSTATS] = kruskalwallis(z_data, z_group);
z_posthoc = multcompare(zSTATS,'CType','bonferroni');
p_vals_z = find(z_posthoc(:,6)<0.05);
0 个评论
回答(1 个)
Pratyush
2023-12-15
Hi Hannah,
I understand that you are getting 'NaN' values in the p-value column of the 'multcompare' output when using the 'bonferroni' method, which could be due to:
You should probably check the group sizes and variances to ensure there are no groups with zero variance.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Hypothesis Tests 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!