spkit.stats.test_groups

spkit.stats.test_groups(x, axis=0, alpha=0.05, title=None, printthr=1, notes=False, print_round=4, return_all=False)

Test multiple groups: One-way Anova

Parameters:
x: list of groups/sample or 2d-array
  • if list x = [x1,x2,x3], for testing x1, x2, and x3 as three groups

  • if np.array, axis determine the groups/sample

axis: 0 or 1,
  • only used if x is np.array,

  • to determine the sample axis

alpha: scalar [0,1], default=0.05
  • alpha level,

  • threshold on p-value for passing/failing declaration

print_round: int, default=4
  • rounding off all the numbers to decimal points

  • print_round=4 means upto 4 decimal points

  • print_round=-1 means all the decimal points available

title: str, default=None
  • if passed as str, used as heading with “Final Test”

  • useful when running many tests

printthr: scalar [0,1], deafult=1
  • threhold on p-value to display the results of final test

  • if p-value of final test is >printthr then ‘final test’ results are not printed

  • default=1 to always print the results of final test

notes: bool, default=True,
  • if True, printing explaination

return_all: bool, default=False
  • if True, two tables of all the results are returned

Returns:
tPass: bool
  • True, if any one of the final test was passed (i.e., p-value < alpha)

  • False means, none of the final test was passed

df_tests: pd.DataFrames
  • df_tests: Table of the test

Examples

>>> #sp.stats.test_groups
>>> import numpy as np
>>> import spkit as sp
>>> np.random.seed(1)
>>> x1 = np.random.randn(100)
>>> x2 = np.random.randn(100)+0.15
>>> x3 = np.random.rand(100)
>>> tPass,df = sp.stats.test_groups(x=[x1,x2,x3],return_all=True,print_round=4,title='test-example', notes=True)
>>> print(df)
                p-value     stats
One-way ANOVA  0.000111  9.388809