dlm-js
    Preparing search index...

    Interface DlmFitOptions

    Options for dlmFit and dlmFitTensor.

    interface DlmFitOptions {
        algorithm?: DlmAlgorithm;
        arCoefficients?: number[];
        dtype?: DlmDtype;
        F?: number[][];
        fullSeasonal?: boolean;
        harmonics?: number;
        obsStd: number | ArrayLike<number> | number[][];
        order?: number;
        processStd: number[];
        seasonLength?: number;
        spline?: boolean;
        stabilization?: DlmStabilization;
        timestamps?: number[];
        X?: ArrayLike<number>[];
    }

    Hierarchy (View Summary)

    Properties

    algorithm?: DlmAlgorithm

    Algorithm selection. 'scan' = sequential, 'assoc' = parallel associative scan. Default: auto-select from device/dtype.

    arCoefficients?: number[]

    AR coefficients (initial values). In MATLAB DLM, this is arphi.

    dtype?: DlmDtype

    Computation precision. Default: 'f64'.

    F?: number[][]

    Observation matrix F [p, m]. When provided, p is inferred from F.length (first dimension) and y must be 2D [n, p]. When omitted, F is derived from dlmGenSys (p=1, univariate).

    fullSeasonal?: boolean

    Full seasonal component (ns-1 dummy variables). In MATLAB DLM, this is fullseas.

    harmonics?: number

    Number of trigonometric harmonic pairs. In MATLAB DLM, this is trig.

    obsStd: number | ArrayLike<number> | number[][]

    Observation noise std dev(s).

    Univariate (p=1):

    • number: same std for all timesteps.
    • ArrayLike<number> of length n: per-timestep observation noise.

    Multivariate (p>1): inferred when F is provided.

    • number: same std for all series and timesteps → V² = s²·Iₚ.
    • number[] of length p: per-series → V²(t) = diag(s₀², …, sₚ₋₁²).
    • number[][] of shape [n, p]: per-timestep per-series.
    order?: number

    Polynomial trend order: 0 (level), 1 (level + slope), 2 (level + slope + acceleration). Default: 1.

    processStd: number[]

    Process noise std devs (diagonal of √W). Length determines which states have noise.

    seasonLength?: number

    Seasons per cycle (period length). In MATLAB DLM, this is ns. Default: 12.

    spline?: boolean

    Spline mode for order=1: modifies W for integrated random walk.

    stabilization?: DlmStabilization

    Stabilization mode for the backward smoother.

    • 'matlab' — MATLAB dlmsmo.m exact match (cTriuSym + cSmoAbsDiag).
    • 'none' — Disable all optional stabilization flags.
    • Object — Fine-grained DlmStabilizationFlags for research.
    • undefined (omit) — Library defaults per dtype.

    See DlmStabilization and DlmStabilizationFlags.

    timestamps?: number[]

    Observation timestamps (length n). When provided, G and W become time-varying: G(Δt_k) and W(Δt_k) are computed via closed-form continuous-time discretization for each step Δt_k = t[k] - t[k-1].

    Supported model components: polynomial trend (order 0, 1, 2) and trigonometric harmonics. Throws if fullSeasonal or AR components are used (these are purely discrete-time constructs).

    When omitted, all timesteps use Δt = 1 (uniform spacing, equivalent to the standard DLM convention).

    Tip — interpolation at query points: To obtain smoothed estimates at times where no observation exists (e.g., regular grid over an irregular series), insert NaN observations at those timestamps. The smoother treats NaN as missing data (pure prediction step with widening covariance), giving you interpolated state estimates and uncertainty bands at arbitrary query points — no separate forecast call needed.

    X?: ArrayLike<number>[]

    Covariate matrix: n rows × q columns. X[t] is the covariate row at time t.