import Normal from '../dist/normal'; import Process from './_process'; /** * First-order autoregressive (AR(1)) process, the discrete-time analogue of the * Ornstein-Uhlenbeck process. * * The update rule per step is * * $X_{n+1} = \phi X_n + \sigma Z,$ * * where $Z \sim \mathcal{N}(0, 1)$. For $|\phi| < 1$ the process is stationary with * marginal distribution $\mathcal{N}(0, \sigma^2/(1-\phi^2))$. For $|\phi| \geq 1$ * the process is non-stationary and grows without bound; a warning is emitted but no * error is thrown. * * @class AR1 * @memberof ran.process * @constructor */ export default class AR1 extends Process { p: { phi: number; sigma: number; }; x: number; x0: number; /** * @param {number} phi Autoregressive coefficient. * @param {number} sigma Innovation standard deviation (must be > 0). */ constructor(phi: number, sigma: number); _next(): 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 phi and sigma from an observed path via OLS regression of X_{n+1} on X_n, reusing * the same ols() helper as OrnsteinUhlenbeck.fit(). The true transition has no intercept * (_next() is phi*X_n + sigma*Z), but fitting through the shared intercept-plus-slope form * still recovers phi consistently since the true intercept is exactly 0; only the slope is * kept and the intercept is otherwise discarded, apart from computing residuals for sigma. * * @method fit * @memberof ran.process.AR1 * @param {Array} path Array of observed states (as returned by path()). * @returns {AR1} A new instance with estimated phi and sigma. * @throws {Error} If path has fewer than 4 states. */ static fit(path: any[]): AR1; }