ftest_equal_var

hana_ml.algorithms.pal.stats.ftest_equal_var(data_x, data_y, test_type=None)

Tests the equality of two random variances using F-test. The null hypothesis is that two independent normal variances are equal. The observed sums of some selected squares are then examined to see whether their ratio is significantly incompatible with this null hypothesis.

Parameters:
data_xDataFrame

DataFrame containing the first column data.

data_yDataFrame

DataFrame containing the second column data.

test_type{'two_sides', 'less', 'greater'}, optional

Specifies the alternative hypothesis type.

Default to "two_sides".

Returns:
DataFrame

Test results, structured as follows:

  • STAT_NAME, name of statistics.

  • STAT_VALUE, value of statistics.

Examples

Original data:

>>> df_x.collect()
   X
0  1
1  2
2  4
3  7
4  3
>>> df_y.collect()
      Y
0  10.0
1  15.0
2  12.0

Apply the ftest_equal_var function:

>>> res = ftest_equal_var(data_x=df_x,
                          data_y=df_y,
                          test_type='two_sides')
>>> res.collect()
                       STAT_NAME  STAT_VALUE
0                        F Value    0.836842
1    numerator degree of freedom    4.000000
2  denominator degree of freedom    2.000000
3                        p-value    0.783713