PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, October 9, 2022

[FIXED] What does "inf" mean for F value in scipy.stats.f_oneway?

 October 09, 2022     anova, pandas, python, scipy, statistics     No comments   

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:

enter image description here


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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing