import Normal from '../dist/normal'; import Process from './_process'; /** * Brownian motion (Wiener process) with drift, using an exact discrete-time sampler. * * The underlying SDE is * * $\mathrm{d}X_t = \mu \mathrm{d}t + \sigma \mathrm{d}W_t.$ * * Because the coefficients are constant (state-independent), the Euler–Maruyama step coincides * with the exact transition: each increment is an independent draw from * $\mathcal{N}(\mu \mathrm{d}t ,\sigma^2 \mathrm{d}t)$, giving the update rule * * $X_{t+\mathrm{d}t} = X_t + \mu\,\mathrm{d}t + \sigma\sqrt{\mathrm{d}t}\,Z,$ * * where $Z \sim \mathcal{N}(0, 1)$. There is no step-size discretization error. * * @class BrownianMotion * @memberof ran.process * @constructor */ export default class BrownianMotion extends Process { p: { mu: number; sigma: number; dt: number; }; x: number; x0: number; c: { sqrtDt: number; sigmaDt: number; logSigmaDt: number; }; /** * @param {number} mu Drift coefficient. * @param {number} sigma Diffusion coefficient (must be > 0). * @param {number} [dt=1] Time step (must be > 0). */ constructor(mu: number, sigma: number, dt?: number); _next(): number; /** * The one-step transition X_{i+1} | X_i is Normal(X_i + mu*dt, sigma^2*dt), the same law * _next() draws from. * * @method _transitionLnPdf * @memberof ran.process.BrownianMotion * @param {number} xPrev State at the start of the step. * @param {number} xNext State at the end of the step. * @returns {number} Log-density of the transition xPrev -> xNext. * @protected * @ignore */ protected _transitionLnPdf(xPrev: number, xNext: number): number; /** @inheritdoc */ mean(t: any): number; /** @inheritdoc */ variance(t: any): number; /** @inheritdoc */ pdf(x: any, t: any): number; /** @inheritdoc */ covariogram(s: any, t: any): number; /** @inheritdoc */ marginal(t: any): Normal; /** * Estimates mu and sigma from an observed path via the exact MLE: increments are i.i.d. * Normal(mu*dt, sigma^2*dt), so sample mean/variance of the increments (divided by dt) * recovers the parameters to machine precision as the path length grows. * * @method fit * @memberof ran.process.BrownianMotion * @param {Array} path Array of observed states (as returned by path()). * @param {number} [dt=1] Time step between consecutive path observations (must be > 0). * @returns {BrownianMotion} A new instance with estimated mu and sigma. * @throws {Error} If path has fewer than 3 states, or if dt is not > 0. */ static fit(path: any[], dt?: number): BrownianMotion; }