How to Perform an F-Test in Python
In this article, we will be looking at the approach to performing an F-Test in the python programming language. The scipy stats.f() function in Python with the certain parameters required to be passed to get the F- test of the given data.
scipy stats.f(): It is an F continuous random variable that is defined with a standard format and some shape parameters to complete its specification.
Syntax: scipy stats.f()
- x : quantiles
- q : lower or upper tail probability
- dfn, dfd shape parameters
- loc :location parameter
- scale : scale parameter (default=1)
- size :shape of random variate
- moments : composed of letters [‘mvsk’] specifying which moments to compute
In this example, we will be using the data from the normalized distributed sample and with the different variance values and we will be further using the scipy.stats.f.cdf() to get the data’s F-test in the python programming language.
0.010464 0.00042400000000000017— Variances
(24.679245283018858, 0.004431318383760985) –F-test values
Interpretation from the test:
The F test statistic is 24.67 and the p-value is 0.0044 we would reject the null hypothesis asp-value<=0.05 so we can say simply by looking at the p-value of the data used that the two population variances are not equal.