dlm-js
    Preparing search index...

    Function dlmFit

    • Fit a Dynamic Linear Model (DLM).

      Implements a two-pass estimation procedure:

      1. Initial pass with diffuse prior to estimate starting values
      2. Final pass with refined initial state from smoothed estimates

      Model components are determined by the options parameter:

      • Polynomial trend (order 0/1/2)
      • Full or trigonometric seasonal
      • AR(p) components

      When X is provided (n×q covariate matrix), the observation equation becomes: y(t) = F_base·x(t) + X[t,:]·β + v

      The β coefficients are appended to the state vector as static states (identity evolution, zero process noise), matching the MATLAB DLM convention.

      System matrices G and F are generated by dlmGenSys(). State noise covariance W = diag(w[0]², w[1]², ...) with zeros for states beyond processStd.length.

      Parameters

      Returns Promise<DlmFitResult>

      Complete model fit with smoothed estimates and diagnostics