spectral_connectivity.statistics.power_fisher_z_transform#
- power_fisher_z_transform(spectrum1: ndarray[tuple[int, ...], dtype[floating]], n_obs1: int, spectrum2: ndarray[tuple[int, ...], dtype[floating]] | float = 1.0, n_obs2: int = 0) ndarray[tuple[int, ...], dtype[floating]][source]#
Transform power spectrum estimates for statistical testing.
Applies log-transformation with bias correction to power spectrum estimates, enabling approximately normal distributions for hypothesis testing. Can perform one-sample test against baseline or two-sample comparison.
- Parameters:
spectrum1 (NDArray[floating], shape (...,)) – Power spectrum estimates from first condition.
n_obs1 (int) – Number of observations for spectrum1 (n_tapers * n_trials).
spectrum2 (NDArray[floating] or float, default=1.0) – For a two-sample comparison (
n_obs2 > 0), the power spectrum estimates from the second condition. For a one-sample test (n_obs2 == 0), a fixed positive baseline power against whichspectrum1is compared; must be > 0 because the test operates onlog(power).n_obs2 (int, default=0) – Number of observations for spectrum2 (n_tapers * n_trials). If 0, performs a one-sample test of
spectrum1against the fixed baselinespectrum2.
- Returns:
z_scores – Z-scores for statistical testing of power differences.
- Return type:
NDArray[floating], shape (…,)
Examples
>>> import numpy as np >>> # One-sample test against a fixed baseline power of 1.0 >>> power1 = np.array([0.5, 1.0, 2.0, 0.8]) >>> z_one = power_fisher_z_transform(power1, n_obs1=100, spectrum2=1.0) >>> >>> # Two-sample comparison >>> power2 = np.array([0.3, 0.8, 1.5, 0.9]) >>> z_two = power_fisher_z_transform(power1, 100, power2, 120)
Notes
Uses bias correction based on sample size to improve the normal approximation for statistical testing.