pyhctsa.operations.hypothesis_tests.distribution_test

pyhctsa.operations.hypothesis_tests.distribution_test(x, the_test='chi2gof', the_distn='norm', num_bins=10)

Hypothesis test for distributional fits to a data vector.

Fits a distribution to the data and then performs an appropriate hypothesis test to quantify the difference between the two distributions.

Parameters:
x : array-like

The input data vector.

the_test : str, optional

The hypothesis test to perform:

  • ’chi2gof’: chi^2 goodness of fit test

  • ’ks’: Kolmogorov-Smirnov test

  • ’lillie’: Lilliefors test (only defined for ‘norm’, ‘ev’, and ‘exp’)

Default is 'chi2gof'.

the_distn : str, optional

The distribution to fit:

  • ’norm’ (Normal)

  • ’ev’ (Extreme value)

  • ’uni’ (Uniform)

  • ’beta’ (Beta)

  • ’rayleigh’ (Rayleigh)

  • ’exp’ (Exponential)

  • ’gamma’ (Gamma)

  • ’logn’ (Log-normal)

  • ’wbl’ (Weibull)

Default is 'norm'.

num_bins : int, optional

The number of bins to use for the chi^2 goodness of fit test. Default is 10.

Returns:

P-value from the hypothesis test. NaN when the fit is not valid for the data (e.g., a positive-only distribution fitted to data with negative values).

Return type:

float