draw_critical_values#

pycafee.normalitycheck.kolmogorovsmirnov.KolmogorovSmirnov.draw_critical_values(self, ax=None, export=None, extension=None, file_name=None, dpi=None, decimal_separator=None)#

Draw a plot with the Kolmogorov Smirnov critical data [1].

Parameters
axNone or matplotlib.axes.SubplotBase

If ax is None, a figure is created with a preset design. The other parameters can be used to export the graph. If ax is a matplotlib.axes.SubplotBase, the function returns a matplotlib.axes.SubplotBase with the Kolmogorov Smirnov critical data. In this case, the other parameters do not affect the graph.

exportbool, optional

Whether the graph should be exported (True) or not (False). The default value is None, which implies False.

file_namestr, optional

The file name. Default is None which results in a file named "kolmogorov_smirnov_critical_plot".

extensionstr, optional

The file extension without a dot. Default is None which results in a ".png" file.

dpiint or float, optional

The figure pixel density. The default is None, which results in a 100 dpis picture. This parameter must be a number higher than zero.

decimal_separatorstr, optional

The decimal separator symbol used in the chart. It can be the dot (None or '.') or the comma (',').

Returns
axesmatplotlib.axes._subplots.AxesSubplot

The axis of the graph.

See also

get_critical_value

Returns the critical value.

fit

performs the Kolmogorov Smirnov Normality test.

Notes

To obtain the tabulated values of the Kolmogorov Smirnov test, use:

>>> from pycafee.normalitycheck.kolmogorovsmirnov import KolmogorovSmirnov
>>> ks_test = KolmogorovSmirnov()
>>> KS_TABLE = ks_test.KOLMOGOROV_SMIRNOV_TABLE
>>> print(KS_TABLE)

References

1

FRANK J. MASSEY, J. The Kolmogorov-Smirnov Test for Goodness of Fit. Journal of the American Statistical Association, v. 46, n. 253, p. 68–78, 1951. DOI: 10.2307/2280095.

Examples

Using the figure created inside the function

>>> from pycafee.normalitycheck.kolmogorovsmirnov import KolmogorovSmirnov
>>> ks_test = KolmogorovSmirnov()
>>> ax = ks_test.draw_critical_values(export=True)
    The 'kolmogorov_smirnov_critical_plot.png' file has been exported
Graph showing the tabulated values of the Kolmogorov Smirnov test for different alpha values

Using a previously created figure

>>> from pycafee.normalitycheck.kolmogorovsmirnov import KolmogorovSmirnov
>>> import matplotlib.pyplot as plt
>>> ks_test = KolmogorovSmirnov(language='pt-br')
>>> fig, ax = plt.subplots(figsize=(8,6))
>>> ax = ks_test.draw_critical_values(ax=ax)
>>> plt.savefig("ks_plot.png")
>>> plt.show()
Graph showing the tabulated values of the Kolmogorov Smirnov test for different alpha values