我不认为这是建立在MATLAB费舍尔的组合概率测试,但它不应该是很难实现:
P = [0.43 0.12 0.0021 0.05 0.017 0.001 0.025 0.038 0.35 0.29];
k = length(P);
首先我们要造一个配偶帮助矩阵总结中的元素数p作为我们想:
% the following matrix is used to sun each n elements in a row:
n = 3;
summer = diag(ones(k,1));
for d = 1:n-1
summer = summer + diag(ones(k-d,1),-d);
end
如果我们运行P*summer,我们得到:
ans =
Columns 1 through 6
0.5521 0.1721 0.0691 0.068 0.043 0.064
Columns 7 through 10
0.413 0.678 0.64 0.29
接下来,我们首先采取一切P的LN计算统计,比它们求和3的(和-2乘):
% compute the combine fisher statistic:
X = -2.*log(P(:).')*summer;
结果:
X =
Columns 1 through 6
18.26 22.564 26.472 27.956 29.342 27.734
Columns 7 through 10
16.018 11.116 4.5754 2.4757
最后我们计算P-
% get the p-values for all combinations:
p_vals = chi2cdf(X(1:end-n+1),6,'upper');
而我们得到:与
2*3 = 6 DF从卡方分布值
p_vals =
Columns 1 through 6
0.005614 0.00095661 0.00018177 9.577e-05 5.2399e-05 0.00010546
Columns 7 through 8
0.013659 0.084865