mixle.stats.processes.power_law_hawkes module

A self-exciting (Hawkes) point process with a power-law triggering kernel and productivity marks.

The library’s HawkesProcessDistribution uses an exponential triggering kernel, whose memorylessness gives an O(n) recursion. Many self-exciting processes instead trigger with a heavy- tailed power-law kernel g(s) = (1 + s/c)^{-p} (long memory; the events keep mattering far into the future), and many are marked – each event carries a value m_i that scales how strongly it excites the future, productivity = A * exp(alpha * m_i). This distribution covers that general case. The conditional intensity

lambda(t) = mu + sum_{t_j < t} A e^{alpha m_j} (1 + (t - t_j)/c)^{-p}

is the forecast rate; log_density is the exact realization likelihood, sampler draws catalogues by branching, and the estimator fits (mu, A, alpha, c, p) by maximum likelihood. Domain-neutral: an event catalogue is just (times, marks) on a window [0, T].

Reference: Hawkes, ‘Spectra of some self-exciting and mutually exciting point processes’, Biometrika (1971).

class PowerLawHawkesDistribution(mu, A, c, p, window, *, alpha=0.0, mark_dist=None, name=None, keys=None)[source]

Bases: SequenceEncodableProbabilityDistribution

Marked power-law-kernel Hawkes process on a fixed window [0, window].

A realization is (times, marks) – a sorted event-time array and a matching mark array (use zeros, or omit, for the unmarked process). mu > 0 is the background rate, A >= 0 the productivity, alpha the mark sensitivity, and c > 0, p > 1 the Omori-Utsu kernel scale and exponent.

intensity(t, times, marks=None)[source]

The conditional rate lambda(t) given the catalogue so far – the instantaneous forecast.

Parameters:

t (float)

Return type:

float

expected_count(t_start, t_end, times, marks=None)[source]

Expected number of events in [t_start, t_end] given the catalogue – the window forecast.

Parameters:
Return type:

float

branching_ratio(mean_mark=0.0)[source]

Expected direct offspring per event A c/(p-1) e^{alpha * mean_mark} – criticality (<1 stable).

Parameters:

mean_mark (float)

Return type:

float

density(x)[source]

Return the probability density or mass at a single observation.

Concrete default: exponentiate log_density (the abstract method subclasses must provide). Leaves with a cheaper closed form may override this.

Return type:

float

log_density(x)[source]

Exact log-likelihood of one realization on [0, window].

Return type:

float

seq_log_density(x)[source]

Return vectorized log-density values for sequence-encoded observations.

Return type:

ndarray

sampler(seed=None)[source]

Return a sampler for drawing observations from this distribution.

Parameters:

seed (int | None)

Return type:

PowerLawHawkesSampler

estimator(pseudo_count=None)[source]

Return an estimator for fitting this distribution from data.

Parameters:

pseudo_count (float | None)

Return type:

PowerLawHawkesEstimator

dist_to_encoder()[source]

Return the data encoder used by this distribution for vectorized methods.

Return type:

PowerLawHawkesDataEncoder

class PowerLawHawkesEstimator(window, *, alpha_fixed=None, name=None, keys=None)[source]

Bases: ParameterEstimator

Maximum-likelihood estimator of (mu, A, alpha, c, p) over realizations on a common window.

Parameters:
accumulator_factory()[source]
estimate(nobs, suff_stat)[source]
Return type:

PowerLawHawkesDistribution