spectral_connectivity.statistics.power_variance#

power_variance(n_observations: int) → float[source]#

Compute variance of log-power spectrum estimates.

Calculates the variance of log-transformed power spectrum estimates for use in statistical testing and confidence interval computation.

Parameters:

n_observations (int) – Number of observations used in power estimation (n_tapers * n_trials).

Returns:

variance – Variance of log-power estimates.

Return type:

float

Examples

>>> var_100 = power_variance(100)
>>> var_1000 = power_variance(1000)
>>> print(f"Variance with 100 obs: {var_100:.6f}")
Variance with 100 obs: 0.010050
>>> print(f"Variance with 1000 obs: {var_1000:.6f}")
Variance with 1000 obs: 0.001001

Notes

With S_hat / S ~ chi2_nu / nu and nu = 2 * n_observations, the variance of log(S_hat) is the trigamma function evaluated at the chi-squared shape parameter nu / 2 = n_observations.