필터 지우기
필터 지우기

multcompare function: p-values are NaN if bonferroni method is used

조회 수: 3 (최근 30일)
Hannah_Mad
Hannah_Mad 2022년 1월 10일
답변: Pratyush 2023년 12월 15일
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);

답변 (1개)

Pratyush
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:
  1. 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.
  2. 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.
You should probably check the group sizes and variances to ensure there are no groups with zero variance.

카테고리

Help CenterFile Exchange에서 Hypothesis Tests에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by