Combining P values using Fisher method matlab?

浪尽此生 提交于 2019-12-23 21:16:22

问题


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]

I want to combine my P values with the help of Fisher method and get the output in the following way:

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.

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.

Fisher's method combines extreme value probabilities from each test, commonly known as "p-values", into one test statistic (X2) using the formula :

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 :)

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.


回答1:


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);

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

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

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;

the result:

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

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');

And we get:

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


来源:https://stackoverflow.com/questions/39128063/combining-p-values-using-fisher-method-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!