spectral_connectivity.statistics.coherence_bias#
- coherence_bias(n_observations: int | NDArray[integer]) float | NDArray[floating][source]#
Estimate bias correction for coherence estimates.
Coherence estimates are biased by finite sample size. This function computes the bias correction factor that can be subtracted from Fisher z-transformed coherence estimates. It assumes complex Fourier coefficients and does not hold at the 0 Hz and Nyquist bins of a real signal, whose coefficients are real (see
coherence_fisher_z_transform()).- Parameters:
n_observations (int) – Number of observations used in coherence estimation (n_tapers * n_trials), at least 2: pass
Connectivity.n_observations.- Returns:
bias – Bias correction factor for Fisher z-transform of coherence.
- Return type:
- Raises:
ValueError – If
n_observationsis not a finite integer of at least 2.
Examples
>>> print(f"Bias with 100 obs: {coherence_bias(100):.6f}") Bias with 100 obs: 0.005051 >>> print(f"Bias with 1000 obs: {coherence_bias(1000):.6f}") Bias with 1000 obs: 0.000501
References
[1]Enochson, L.D., and Goodman, N.R. (1965). Gaussian approximations to the distribution of sample coherence (Measurement analysis corp Los Angeles CA).
[2]Bokil, H., Purpura, K., Schoffelen, J.-M., Thomson, D., and Mitra, P. (2007). Comparing spectra and coherences for groups of unequal size. Journal of Neuroscience Methods 159, 337-345. 10.1016/j.jneumeth.2006.07.011.