https://raw.githubusercontent.com/MatthewReid854/reliability/master/docs/images/logo.png

KStest

class reliability.Reliability_testing.KStest(distribution, data, significance=0.05, print_results=True, show_plot=True)

Performs the Kolmogorov-Smirnov goodness of fit test to determine whether we can accept or reject the hypothesis that the data is from the specified distribution at the specified level of significance.

This method is not a means of comparing distributions (which can be done with AICc, BIC, and AD), but instead allows us to accept or reject a hypothesis that data come from a distribution.

Parameters:
  • distribution (object) – A distribution object created using the reliability.Distributions module.

  • data (array, list) – The data that are hypothesised to come from the distribution.

  • significance (float) – This is the complement of confidence. 0.05 significance is the same as 95% confidence. Must be between 0 and 0.5. Default = 0.05.

  • print_results (bool, optional) – If True the results will be printed. Default = True

  • show_plot (bool, optional) – If True a plot of the distribution CDF and empirical CDF will be generated. Default = True.

Returns:

  • KS_statistic (float) – The Kolmogorov-Smirnov statistic.

  • KS_critical_value (float) – The Kolmogorov-Smirnov critical value.

  • hypothesis (string) – ‘ACCEPT’ or ‘REJECT’. If KS_statistic < KS_critical_value then we can accept the hypothesis that the data is from the specified distribution.