get_critical_value#

pycafee.normalitycheck.shapirowilk.ShapiroWilk.get_critical_value(self, n_rep, alfa=None)#

This function returns the critical value (tabulated) of the Shapiro Wilk [1] test.

Parameters
alfafloat

The significance level (between 0.0 and 1.0, default = 0.05)

n_repint

The total number of observations (n_rep >= 3).

Returns
criticalfloat or None.

The critical value for the requested confidence level.

alfafloat

The corresponding significance level

See also

draw_critical_values

Draws a plot with the critical values for several alpha values.

fit

performs the Kolmogorov Smirnov Normality test.

Notes

The critical value is returned only if the number of observations is at least 3 (n_rep >= 3).

If the number of repetitions is higher than 50 (n_rep > 50), the function returns the tabulated value for 50 (n_rep = 50) observations.

This function has tabulated values for the following confidence levels [1]:

  • 99% (ɑ = 0.01);

  • 98% (ɑ = 0.02);

  • 95% (ɑ = 0.05);

  • 90% (ɑ = 0.10);

  • 50% (ɑ = 0.50);

The function returns None for other confidence levels.

References

1(1,2)

SHAPIRO, S. S.; WILK, M. B. An Analysis of Variance Test for Normality (Complete Samples). Biometrika, v. 52, n. 3, p. 591–611, 1965. DOI: 10.2307/2333709.

Examples

Getting tabulated value for 5% of significance and 5 observations

>>> from pycafee.normalitycheck.shapirowilk import ShapiroWilk
>>> sw_test = ShapiroWilk()
>>> critical_value = sw_test.get_critical_value(n_rep=5)
>>> print(critical_value)
ShapiroWilkResult(critical=0.762, alpha=0.05)

Getting tabulated value for 1% of significance and 10 observations

>>> from pycafee.normalitycheck.shapirowilk import ShapiroWilk
>>> sw_test = ShapiroWilk()
>>> critical_value = sw_test.get_critical_value(n_rep=10, alfa=0.01)
>>> print(critical_value)
ShapiroWilkResult(critical=0.781, alpha=0.01)