使用Fisher方法Matlab合并P值? [英] Combining P values using Fisher method matlab?
问题描述
执行CDF之后,我收到以下P
值(它们的样本)
After doing CDF I received following values of P
(Sample of them)
[0.43 0.12 0.0021 0.05 0.017 0.001 0.025 0.038 0.35 0.29]
我想在 Fisher 方法的帮助下结合我的P
值通过以下方式获取输出:
I want to combine my P
values with the help of Fisher method and get the output in the following way:
选择前3个P
值并将其组合并从中获取结果(使用fisher方法).例如,我的第一个合并P
值将是:0.43 ,0.12 0.0021
,而我的下一个P
合并值将是0.12, 0.0021 ,0.05
,依此类推.
Select first 3 P
values and combines them and get result from this (using fisher method). For example, my first combine P
value would be : 0.43 ,0.12 0.0021
and my next P
combine value would be 0.12, 0.0021 ,0.05
and so on.
有人可以告诉我如何使用MATLAB使用Fisher方法解决此问题吗?
我无法使用MATLAB找到任何解决方案.
Can anyone tell me how we can apply Fisher method using MATLAB for this problem?
I wasn't able to find any solution using MATLAB.
费舍尔的方法使用公式将每个测试的极值概率(通常称为"p值")组合到一个测试统计量(X2)中:
Fisher's method combines extreme value probabilities from each test, commonly known as "p-values", into one test statistic (X2) using the formula :
文档讲述了费舍尔方法,我用圆圈标记了可以使用的公式使用fisher方法组合p值的方法,请看:)
documents tells about fisher method and I marked in circle the formula which can be used for combining the p value via using fisher method please have a look :)
其中pi是第i个假设检验的p值.当p值趋于较小时,检验统计量X2将较大,这表明无效假设并非对每个检验都成立.
where pi is the p-value for the ith hypothesis test. When the p-values tend to be small, the test statistic X2 will be large, which suggests that the null hypotheses are not true for every test.
推荐答案
我不认为在MATLAB中构建了Fisher组合概率检验,但是实现起来并不难:
I don't think there is a Fisher's combined probability test built in MATLAB, but it shouldn't be hard to implement it:
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中的元素求和:
first we will make a helper matrix that sum the elements in P as we want:
% 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
,我们将得到:
if we run P*summer
, we get:
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
):
Next, we compute the statistic by first taking the ln of all P
and than sum them in 3's (and multiply by -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
最后,我们使用2*3 = 6
df通过卡方分布计算p值:
Finally we compute the p-values from a chi-square distribution with 2*3 = 6
df:
% get the p-values for all combinations:
p_vals = chi2cdf(X(1:end-n+1),6,'upper');
我们得到:
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
这篇关于使用Fisher方法Matlab合并P值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!