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.
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