_normal_order_statistic#

normtest.ryan_joiner._normal_order_statistic(x_data, weighted=False, cte_alpha='3/8')[source]#

This function transforms the statistical order to the standard Normal distribution scale (\(z_{i}\)).

Parameters:
x_datanumpy array

One dimension numpy array with at least 4 observations.

cte_alphastr, optional

A str with the cte_alpha value that should be adopted. The options are:

  • “0”;

  • “3/8” (default);

  • “1/2”;

weightedbool, optional

Whether to estimate the Normal order considering the repeats as its average (True) or not (False, default). Only has an effect if the dataset contains repeated values;

Returns:
zinumpy array

The statistical order in the standard Normal distribution scale.

See also

rj_test

Notes

The transformation to the standard Normal scale is done using the equation:

\[z_{i} = \phi^{-1} \left(p_{i} \right)\]

where \(p_{i}\) is the normal statistical order and \(\phi^{-1}\) is the inverse of the standard Normal distribution. The transformation is performed using stats.norm.ppf().

The statistical order (\(p_{i}\)) is estimated using _order_statistic() function. See this function for details on parameter cte_alpha.

Examples

The first example uses weighted=False:

>>> import numpy as np
>>> from normtest import ryan_joiner
>>> data = np.array([148, 148, 154, 158, 158, 160, 161, 162, 166, 170, 182, 195, 210])
>>> result = ryan_joiner._normal_order_statistic(data, weighted=False)
>>> print(result)
[-1.67293739 -1.16188294 -0.84837993 -0.6020065  -0.38786869 -0.19032227
0.          0.19032227  0.38786869  0.6020065   0.84837993  1.16188294
1.67293739]

The second example uses weighted=True, with the same data set:

>>> result = ryan_joiner._normal_order_statistic(data, weighted=True)
>>> print(result)
[-1.37281032 -1.37281032 -0.84837993 -0.4921101  -0.4921101  -0.19032227
0.          0.19032227  0.38786869  0.6020065   0.84837993  1.16188294
1.67293739]

Note that the results are only different for positions where we have repeated values. Using weighted=True, the normal statistical order is obtained with the average of the order statistic values.

The results will be identical if the data set does not contain repeated values.