plans.stochastic.normality#

Statistical tests for distribution assumptions.

Functions

get_normality(data[, clevel])

Get normality analysis using standard tests.

test_distribution(test_name, stat, p[, ...])

Util function for statistical testing

test_normality_dp(data[, clevel])

Test for normality using the D'Agostino-Pearson test.

test_normality_ks(data[, clevel])

Test for normality using the Kolmogorov-Smirnov test

test_normality_sw(data[, clevel])

Test for normality using the Shapiro-Wilk test.

plans.stochastic.normality.test_distribution(test_name, stat, p, clevel=0.95, distr='normal')[source]#

Util function for statistical testing

The distribution is accepted when \(p > 1 - c\), at confidence level \(c\).

Parameters:
  • test_name (str) – name of test

  • stat (float) – statistic

  • p (float) – p-value

  • clevel (float) – confidence level

  • distr (str) – name of distribution

Returns:

summary of test

Return type:

dict

plans.stochastic.normality.test_normality_ks(data, clevel=0.95)[source]#

Test for normality using the Kolmogorov-Smirnov test

Kolmogorov-Smirnov Test: This test compares the observed distribution with the expected normal distribution using a test statistic and a p-value. A p-value less than 0.05 indicates that the null hypothesis should be rejected.

The sample is first standardized as \(z_i = (x_i - \bar{x}) / s\).

Parameters:
  • data (numpy.ndarray) – vector of data without nan values

  • clevel (float) – confidence level

Returns:

test result dictionary. Keys: Statistic, p-value and Is normal

Return type:

dict

plans.stochastic.normality.test_normality_sw(data, clevel=0.95)[source]#

Test for normality using the Shapiro-Wilk test.

Parameters:
  • data (numpy.ndarray) – vector of data without nan values

  • clevel (float) – confidence level

Returns:

test result dictionary. Keys: Statistic, p-value and Is normal

Return type:

dict

plans.stochastic.normality.test_normality_dp(data, clevel=0.95)[source]#

Test for normality using the D’Agostino-Pearson test.

Parameters:
  • data (numpy.ndarray) – vector of data without nan values

  • clevel (float) – confidence level

Returns:

test result dictionary. Keys: Statistic, p-value and Is normal

Return type:

dict

plans.stochastic.normality.get_normality(data, clevel=0.95)[source]#

Get normality analysis using standard tests.

Parameters:
  • data (numpy.ndarray) – vector of data without nan values

  • clevel (float) – confidence level

Returns:

dataframe of assessment results

Return type:

pandas.DataFrame