import Process from './_process'; /** * Compound Poisson process: cumulative random-magnitude jumps arriving at a Poisson rate. * * At each time step of width $\mathrm{d}t$ the state advances by the sum of * $K \sim \mathrm{Poisson}(\lambda\,\mathrm{d}t)$ independent jumps drawn from * the supplied distribution: * * $X_{t+\mathrm{d}t} = X_t + \sum_{i=1}^{K} J_i,$ * * where $K \sim \mathrm{Poisson}(\lambda\,\mathrm{d}t)$ and $J_i \sim \text{jumpDist}$. * * Unlike the other processes in this module, `marginal(t)` is unsupported for a general * `jumpDist`: because `jumpDist` is an arbitrary caller-supplied `ran.dist` instance, $X_t$ is a * Poisson mixture over sums of an unknown distribution, which has no general closed form * reducible to a single existing `ran.dist` class. The one documented exception is Gamma- * distributed jumps, whose mixture is by definition the compound Poisson-gamma total that * `ran.dist.Tweedie` already represents (see `marginal()` below for the parameter mapping). * * @class CompoundPoisson * @memberof ran.process * @constructor */ export default class CompoundPoisson extends Process { p: { lambda: number; jumpDist: any; dt: number; }; x: number; x0: number; c: { meanJ: any; eJ2: any; }; /** * @param {Object} jumpDist A `ran.dist` Distribution instance whose `.sample()` method supplies jump sizes. * @param {number} lambda Arrival rate (must be > 0). * @param {number} [dt=1] Time step (must be > 0). */ constructor(jumpDist: any, lambda: number, dt?: number); /** @inheritdoc */ seed(value: any): this; _next(): number; /** @inheritdoc */ mean(t: any): number; /** @inheritdoc */ variance(t: any): number; /** @inheritdoc */ covariogram(s: any, t: any): number; /** * Returns the marginal distribution of $X_t$ when `jumpDist` is a `ran.dist.Gamma` instance, * and throws for every other `jumpDist`. $X_t$ is by definition $\sum_{i=1}^{N} J_i$ with * $N \sim \mathrm{Poisson}(\lambda t)$ and $J_i \sim \mathrm{Gamma}(\alpha, \beta)$ (shape, * rate) — exactly the compound Poisson-gamma total `ran.dist.Tweedie` represents as * $\mathrm{Tweedie}(\mu, \phi, p)$, so no new special function or Distribution subclass is * needed. The mapping is derived by matching the two representations' Poisson rate and gamma * shape/rate: * * $p = \frac{\alpha + 2}{\alpha + 1}, \qquad \mu = \frac{\lambda t \alpha}{\beta}, \qquad * \phi = \frac{\alpha + 1}{\beta\, \mu^{1 / (\alpha + 1)}}.$ * * No other jump distribution admits a closed form reducible to an existing `ran.dist` class * (arbitrary `jumpDist` makes $X_t$ a Poisson mixture over an unknown distribution's sums); * adding another allowed case would require new distribution machinery and must be scoped as * a separate prerequisite issue (CLAUDE.md "Prerequisite extraction"). * * @method marginal * @memberof ran.process.CompoundPoisson * @param {number} t Time. * @returns {import('../dist/_distribution').default} A `Tweedie` instance when `jumpDist` is `Gamma`. * @throws {Error} If `t <= 0`, or if `jumpDist` is not a `ran.dist.Gamma` instance. */ marginal(t: number): import('../dist/_distribution').default; /** * Estimates lambda and the jump distribution's parameters from an observed path. Individual * arrival counts within a single dt interval are not observable from the cumulative path — * only the net increment is — so this estimator treats every non-zero increment as exactly * one jump, the same simplification standard for compound Poisson estimation when lambda*dt * is small enough that multi-jump intervals are rare. Under that reading, lambda reduces to * the same count/time MLE as Poisson.fit() (the number of non-zero increments divided by the * total observed time), and the non-zero increments themselves are the recovered jump sizes, * handed to jumpDistConstructor's own static fit(). * * @method fit * @memberof ran.process.CompoundPoisson * @param {Array} path Array of observed states (as returned by path()). * @param {number} [dt=1] Time step between consecutive path observations (must be > 0). * @param {Function} [jumpDistConstructor] A `ran.dist` Distribution class with a static `fit()` method, used to fit the recovered jump sizes. Required at runtime (throws if omitted); optional here only so the generated TypeScript signature stays assignable to `Process.fit`'s `(path, dt?)`. * @returns {CompoundPoisson} A new instance with estimated lambda and a fitted jumpDist. * @throws {Error} If path has fewer than 2 states, if dt is not > 0, if jumpDistConstructor * does not expose a static fit() method, or if the path contains no non-zero increments to * recover jump sizes from. */ static fit(path: any[], dt?: number, jumpDistConstructor?: Function): CompoundPoisson; }