mixle.stats.processes.renewal_process module¶
Renewal process – a point process whose inter-arrival times are i.i.d. from a base distribution.
A renewal process on the window [0, T] generates event times 0 < t_1 < t_2 < ... < t_n <= T such
that the gaps g_1 = t_1, g_i = t_i - t_{i-1} are i.i.d. draws from a positive-support
inter-arrival distribution f (e.g. Gamma, Weibull, LogGaussian, InverseGaussian, Exponential – the
Poisson process is the Exponential special case). The exact log-likelihood of one realization is
log L = sum_i log f(g_i) + log S(T - t_n), S(x) = 1 - F(x) (the survival of the censored last gap)
where the final term is the probability that no further event occurred before the window closed (with
t_0 = 0 and t_n = 0 when there are no events, so an empty realization scores log S(T)). Scoring
is therefore exact, including the right-censored boundary.
Estimation retains both completed gaps and every realization’s right-censored
tail, and fits the full finite-window likelihood. Exponential inter-arrivals
use an exact closed-form censored MLE/update; Gamma, Weibull, LogGaussian, and
InverseGaussian inter-arrivals use bounded numerical likelihood optimization.
Other child estimators fail closed instead of silently discarding censoring.
The window T is fixed, known configuration and is never estimated.
- class RenewalProcessStatistics(gap_statistics, completed_gaps, completed_weights, censored_times, censored_weights)[source]
Bases:
NamedTupleVersioned renewal evidence including right-censoring.
- Parameters:
- gap_statistics: Any
Alias for field number 0
- completed_gaps: ndarray
Alias for field number 1
- completed_weights: ndarray
Alias for field number 2
- censored_times: ndarray
Alias for field number 3
- censored_weights: ndarray
Alias for field number 4
- property schema_version: int
Return the serialized statistic schema version.
- class RenewalProcessDistribution(interarrival, window, name=None, keys=None, max_events=_DEFAULT_MAX_EVENTS)[source]
Bases:
SequenceEncodableProbabilityDistributionRenewal process with i.i.d. inter-arrivals
interarrivalobserved on[0, window].- log_density(x)[source]
Exact log-likelihood of one realization (observed gaps + censored survival).
- seq_log_density(x)[source]
Vectorized log-likelihood for encoded realizations (flattened gaps + per-realization survival).
- sampler(seed=None)[source]
Return a sampler that draws gaps until the cumulative time exceeds
window.- Parameters:
seed (int | None)
- Return type:
RenewalProcessSampler
- estimator(pseudo_count=None)[source]
Return an estimator that fits the inter-arrival distribution to the observed gaps.
- Parameters:
pseudo_count (float | None)
- Return type:
RenewalProcessEstimator
- dist_to_encoder()[source]
Return the data encoder (delegates gap encoding to the inter-arrival encoder).
- Return type:
RenewalProcessDataEncoder
- class RenewalProcessSampler(dist, seed=None)[source]
Bases:
DistributionSamplerDraw inter-arrival gaps from
interarrivaluntil the cumulative time passeswindow.- Parameters:
dist (RenewalProcessDistribution)
seed (int | None)
- class RenewalProcessAccumulator(gap_accumulator, window, name=None, keys=None)[source]
Bases:
SequenceEncodableStatisticAccumulatorFeed the inter-arrival gaps to the inter-arrival distribution’s accumulator (renewal MLE).
- Parameters:
- update(x, weight, estimate)[source]
Accumulate observed inter-arrival gaps from one realization.
- initialize(x, weight, rng)[source]
Initialize the gap accumulator from one realization.
- Parameters:
x (Any)
weight (float)
rng (RandomState | None)
- Return type:
None
- seq_update(x, weights, estimate)[source]
Accumulate encoded observed gaps with realization-level weights.
- seq_initialize(x, weights, rng)[source]
Initialize from encoded observed gaps.
- Parameters:
x (Any)
weights (ndarray)
rng (RandomState | None)
- Return type:
None
- combine(suff_stat)[source]
Merge another inter-arrival sufficient-statistic value.
- Parameters:
suff_stat (Any)
- Return type:
RenewalProcessAccumulator
- from_value(x)[source]
Replace the wrapped inter-arrival accumulator from
x.- Parameters:
x (Any)
- Return type:
RenewalProcessAccumulator
- scale(c)[source]
Scale the wrapped inter-arrival sufficient statistics by
c.- Parameters:
c (float)
- Return type:
RenewalProcessAccumulator
- key_merge(stats_dict)[source]
Delegate keyed statistic merging to the gap accumulator.
- key_replace(stats_dict)[source]
Delegate keyed statistic replacement to the gap accumulator.
- acc_to_encoder()[source]
Return an encoder that converts event times into inter-arrival gaps.
- Return type:
RenewalProcessDataEncoder
- class RenewalProcessAccumulatorFactory(gap_factory, window, name=None, keys=None)[source]
Bases:
StatisticAccumulatorFactoryFactory for RenewalProcessAccumulator (wraps the inter-arrival accumulator factory).
- Parameters:
- make()[source]
Create a fresh renewal-process accumulator.
- Return type:
RenewalProcessAccumulator
- class RenewalProcessEstimator(interarrival_estimator, window, name=None, keys=None, max_events=_DEFAULT_MAX_EVENTS)[source]
Bases:
ParameterEstimatorFit supported inter-arrival families to the full censored likelihood.
- Parameters:
- accumulator_factory()[source]
Return an accumulator factory for observed inter-arrival gaps.
- Return type:
RenewalProcessAccumulatorFactory
- class RenewalProcessDataEncoder(gap_encoder, window)[source]
Bases:
DataSequenceEncoderEncode realizations with raw gaps, child encoding, and censoring metadata.
- Parameters:
gap_encoder (DataSequenceEncoder)
window (float)
- seq_encode(x)[source]
Encode event-time realizations into flattened gaps and censoring metadata.