phitter.discrete.discrete_statistical_tests package

Submodules

phitter.discrete.discrete_statistical_tests.discrete_test_chi_square module

phitter.discrete.discrete_statistical_tests.discrete_test_chi_square.evaluate_discrete_test_chi_square(distribution, discrete_measures)

Chi Square test to evaluate that a sample is distributed according to a probability distribution.

The hypothesis that the sample is distributed following the probability distribution is not rejected if the test statistic is less than the critical value or equivalently if the p-value is less than 0.05

Parameters:
  • data (iterable) – data set

  • distribution (class) – distribution class initialized whit parameters of distribution and methods cdf() and num_parameters()

Returns:

result_test_chi2

  1. test_statistic(float):

    sum over all classes of the value (expected - observed) ^ 2 / expected

  2. critical_value(float):

    inverse of the distribution chi square to 0.95 with freedom degrees n - 1 minus the number of parameters of the distribution.

  3. p-value([0,1]):

    right - tailed probability of the test statistic for the chi - square distribution with the same degrees of freedom as for the critical value calculation.

  4. rejected(bool):

    decision if the null hypothesis is rejected. If it is false, it can be considered that the sample is distributed according to the probability distribution. If it’s true, no.

Return type:

dict

phitter.discrete.discrete_statistical_tests.discrete_test_kolmogorov_smirnov module

phitter.discrete.discrete_statistical_tests.discrete_test_kolmogorov_smirnov.evaluate_discrete_test_kolmogorov_smirnov(distribution, discrete_measures)

Kolmogorov Smirnov test to evaluate that a sample is distributed according to a probability distribution.

The hypothesis that the sample is distributed following the probability distribution is not rejected if the test statistic is less than the critical value or equivalently if the p-value is less than 0.05

Parameters:
  • data (iterable) – data set

  • distribution (class) – distribution class initialized whit parameters of distribution and methods cdf() and num_parameters()

Returns:

result_test_ks

  1. test_statistic(float):

    sum over all data of the value |Sn - Fn|

  2. critical_value(float):

    inverse of the kolmogorov - smirnov distribution to 0.95 whit size of sample N as parameter.

  3. p-value[0,1]:

    probability of the test statistic for the kolmogorov - smirnov distribution whit size of sample N as parameter.

  4. rejected(bool):

    decision if the null hypothesis is rejected. If it is false, it can be considered that the sample is distributed according to the probability distribution. If it’s true, no.

Return type:

dict

Module contents