Issue
I ran a one-way anova, and some groups had "inf" for the F value and "0.000000e+00" for the p value. Does this mean that the difference is significant?
I separated the dataframe using groupby and looped through, example code:
from scipy import stats
c_jobs_anova = []
for name_group in c_jobs.groupby(['Name']):
samples = [condition[1] for condition in name_group[1].groupby('Condition')['Value']]
f_value, p_value = stats.f_oneway(*samples)
print('Group: {}, F value: {:.3f}, p value: {:.3f}'.format(name_group[0], f_value, p_value))
c_jobs_anova.append((name_group[0], f_value, p_value))
The result:
Solution
Yes, very large values of F-statistic indicate high significance, as witnessed by p being reported as 0. Mathematically, F comes up as infinity if there is no in-group variability, e.g.,
>>> stats.f_oneway([2, 2, 2], [1, 1, 1])
F_onewayResult(statistic=inf, pvalue=0.0)
This result is also possible if there is very little in-group variability compared to between-group variability, resulting in numerical overflow.
>>> stats.f_oneway([2, 2, 2], [1, 1, 1.00000001])
F_onewayResult(statistic=inf, pvalue=0.0)
Answered By - user6655984 Answer Checked By - Mildred Charles (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.