_statistic#

normtest.ryan_joiner._statistic(x_data, zi)[source]#

This function estimates the Ryan-Joiner test statistic [1].

Parameters:
x_datanumpy array

One dimension numpy array with at least 4 observations.

zinumpy array

The statistical order in the standard Normal distribution scale.

Returns:
statisticfloat (positive)

The test statistic;

Notes

The test statistic (\(R_{p}\)) is estimated through the correlation between the ordered data and the Normal statistical order:

\[R_{p}=\dfrac{\sum_{i=1}^{n}x_{(i)}z_{(i)}}{\sqrt{s^{2}(n-1)\sum_{i=1}^{n}z_{(i)}^2}}\]

where \(z_{(i)}\) values are the z-score values of the corresponding experimental data (\(x_{({i)}}\)) value, \(n\) is the sample size and \(s^{2}\) is the sample variance.

The correlation is estimated using scipy.stats.pearsonr().

References

[1]

RYAN, T. A., JOINER, B. L. Normal Probability Plots and Tests for Normality, Technical Report, Statistics Department, The Pennsylvania State University, 1976. Available at www.additive-net.de. Access on: 22 Jul. 2023.

Examples

>>> from normtest import ryan_joiner
>>> import numpy as np
>>> x_data = np.array([148, 148, 154, 158, 158, 160, 161, 162, 166, 170, 182, 195, 210])
>>> x_data = np.sort(x_data)
>>> normal_order = ryan_joiner._normal_order_statistic(x_data)
>>> result = ryan_joiner._statistic(x_data, normal_order)
>>> print(result)
0.9225156050800545