braintools.analysis.population.branching_ratio

braintools.analysis.population.branching_ratio#

braintools.analysis.population.branching_ratio(counts, method='ratio')#

Estimate the branching ratio of a population count series.

The branching ratio \(m\) is the expected number of events in bin \(t+1\) per event in bin \(t\); \(m = 1\) marks a critical branching process.

  • 'ratio': the mean of \(n_{t+1} / n_t\) over the bins with \(n_t > 0\) [1].

  • 'regression': the slope of the least-squares regression of \(n_{t+1}\) on \(n_t\), the multistep-regression (MR) estimator at lag 1 [2], which is robust to subsampling.

Parameters:
  • counts (Any) – Population event counts per time bin, shape (T,) with T >= 2.

  • method (str) – Estimator.

Returns:

Scalar estimate. nan when it is undefined: no bin with \(n_t > 0\) ('ratio') or constant \(n_t\) ('regression').

Return type:

Array

Raises:

ValueError – If counts is not 1-D with at least 2 bins, or method is unknown.

See also

avalanches

Sizes and durations of neuronal avalanches.

Notes

Works under jax.jit and jax.vmap and is differentiable with respect to (float) counts.

References

Examples

>>> import jax.numpy as jnp
>>> from braintools.analysis.population import branching_ratio
>>> counts = jnp.array([1., 2., 4., 0., 3., 3.])
>>> float(branching_ratio(counts))  # (2 + 2 + 0 + 1) / 4
1.25
>>> round(float(branching_ratio(2. ** jnp.arange(6.), method='regression')), 4)
2.0