p value of f test
Show older comments
hello i have a problem,whan i preform [p,table2h,stats] = anova1(arr) because my Fst is so big the Pvalue is zero.Obviously he can not be zero when i debuge the code and go to the workspace window and i open the variable p it's value is also zero!( I clicked twise on the cell containing the value zero but still value shown is zero)
moreover i make that xlswrite('axel.xlsx',p,'axel','G34:G34'); and whan i open the axel i saw zero
hwo can i recive the exactly value of Pvalue thank
Accepted Answer
More Answers (2)
Tom Lane
on 2 Jun 2012
This does not produce the exact result you desire, but it may be instructive. Suppose we compute the p-value for different F values. This is the upper tail of the F distribution, so we subtract the cdf from 1. We can do this okay for F=2, but we get zero for F=20 because the cdf is too close to 1 and the difference is less than eps:
>> 1-fcdf(2,6,145584)
ans =
0.0620
>> 1-fcdf(20,6,145584)
ans =
0
We can instead compute the p-value as the lower tail of 1/F and swapping the degrees of freedom. That allows us to achieve values less than eps:
>> fcdf(1/2,145584,6)
ans =
0.0620
>> fcdf(1/20,145584,6)
ans =
1.6677e-23
So if we use this technique to investigate values closer to 272, we find that we can get a non-zero value for F=200 but not F=272:
>> fcdf(1/200,145584,6)
ans =
5.5078e-255
>> fcdf(1/272,145584,6)
ans =
0
Maybe the result is less than realmin which is approximately 2e-308. If I plot the function on a semi-log plot, it looks like the result is close to 1e-340:
semilogy(200:272,fcdf(1./(200:272),145584,6))
2 Comments
Wayne King
on 2 Jun 2012
Nice, Tom!
Edgar Pena
on 8 Jun 2020
Very neat! It worked for me.
Wayne King
on 2 Jun 2012
If you use
>>format long
and display the p-value does it still say 0? What is your F value and what are the numerator and denominator degrees of freedom.
And more importantly is it really necessary to know the p-value exactly if it less than 10^{-8} or 10^{-9} just for sake of argument. Can't you just report something like p<10^{-9}?
Categories
Find more on Analysis of Variance and Covariance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!