netneurotools.metrics.network_covariance

netneurotools.metrics.network_covariance(joint_pmat, D, calc_marginal=True)[source]

Calculate covariance of a joint probability matrix on a graph.

Warning

Test before use.

Parameters:
  • joint_pmat ((N, N) array_like) – Joint probability matrix. Please make sure that it is valid.

  • D ((N, N) array_like) – Distance matrix.

  • calc_marginal (bool, optional) – Whether to calculate marginal variance. It will be marginally faster if calc_marginal=False (returning marginal variances as 0). Default: True

Returns:

  • network_covariance (float) – Covariance of joint_pmat on D

  • var_p (float) – Marginal variance of joint_pmat on D. Will be 0 if calc_marginal=False

  • var_q (float) – Marginal variance of joint_pmat on D. Will be 0 if calc_marginal=False

Notes

The network variance is defined as

\[cov(P) = \frac{1}{2} \sum_{i, j} [p(i) q(j) - P(i,j)] d^2(i,j)\]

where \(P\) is the joint probability matrix, \(p\) and \(q\) are the marginal probability distributions of joint_pmat, and \(d(i,j)\) is the distance between node \(i\) and \(j\).

Check network_variance() for usage.

References

See also

netneurotools.stats.network_variance