The per-neuron univariate KS test (FitResult.computeKSStats)
checks each neuron's marginal conditional intensity in isolation. It can
pass for every neuron while the model still gets the
coupling between neurons wrong — e.g. treating synchronous
cells as independent. Detecting that requires a population-level test.
population_time_rescale(counts_list, lam_per_bin_list, *, n_tau_bins=1)
→ PopulationTimeRescaleResult — the Tao, Weber, Arai &
Eden (2018) marked point-process time-rescaling framework. Pure NumPy/SciPy,
core nstat/fit.py.Two complementary statistics:
λ• = Σk λk,
rescale by Λ•, KS-test the rescaled
inter-event intervals vs. the unit exponential. Detects aggregate-temporal
and dependency misfit (synchrony / coupling).χ² — each
neuron-k spike maps to (τ, k) with
τ = ∫λk; under a correct model these
points uniformly fill R = {(τ, m): 0 ≤ τ ≤ b(m)}.
Detects relative-allocation misfit (and, with n_tau_bins > 1,
within-neuron timing).from nstat import population_time_rescale
r = population_time_rescale(counts_per_neuron, lambda_per_bin_per_neuron, n_tau_bins=5)
r.ground_ks_pvalue # population temporal GOF
r.mark_chi2_pvalue # relative-allocation / coupling GOF
| Scenario | Result |
|---|---|
| Correctly-specified population | neither statistic rejects |
| Wrong overall rate | ground KS rejects (χ² invariant — by design) |
| Synchronous pair modeled as independent | per-neuron univariate KS both pass; population ground KS rejects (p≈3e-49) |
| Wrong relative allocation (right total) | mark χ² rejects; ground KS passes |
| Single neuron | ground process = univariate rescaling |
computeKSStats(..., dt_correction=1));
this iteration adds the multivariate (2018) piece.matlab_gold counterpart (no parity
fixture). The existing univariate computeKSStats and its gold
fixtures are untouched.nstat/fit.py — population_time_rescale +
PopulationTimeRescaleResult (additive).tests/test_population_time_rescale.py — 6 tests
(correct/misspecified/coupling/proportion/consistency/validation).nstat/__init__.py, tests/test_api_surface.py,
AGENT_GUIDE.md, docs/ClassDefinitions.md — exports + helpfiles.