spectral_connectivity.statistics.get_normal_distribution_p_values#

get_normal_distribution_p_values(data: ndarray[tuple[int, ...], dtype[floating]], mean: float = 0, std_deviation: float = 1) ndarray[tuple[int, ...], dtype[floating]][source]#

Compute p-values for normal distribution test.

Given data values, returns the probability that each value was generated from a normal distribution with specified mean and standard deviation. This computes one-tailed p-values (upper tail).

Parameters:
  • data (NDArray[floating], shape (...,)) – Data values to test.

  • mean (float, default=0) – Mean of the null hypothesis normal distribution.

  • std_deviation (float, default=1) – Standard deviation of the null hypothesis normal distribution.

Returns:

p_values – One-tailed p-values (upper tail) for each data point.

Return type:

NDArray[floating], shape (…,)

Examples

>>> import numpy as np
>>> z_scores = np.array([-1.96, 0, 1.96, 2.58])
>>> p_vals = get_normal_distribution_p_values(z_scores)
>>> p_vals
array([0.975, 0.5, 0.025, 0.005])

Notes

This function handles both NumPy and CuPy arrays automatically, falling back to NumPy computation if CuPy fails.