1.15. Diffuse initialization

State-space models with a nonstationary (unit-root) state – a random walk, a stochastic trend, an integrated process – have no finite unconditional variance for the diffuse directions, so the Kalman filter needs a diffuse initial condition. RISE selects the initial covariance through the option kf_init_variance:

[] (default)

The unconditional (Lyapunov) variance for the stationary states and lyapunov_diffuse_factor for the nonstationary ones. Without solve_bgp every state counts as stationary: states with a unit root then have no solution of the Lyapunov equation and keep lyapunov_diffuse_factor. When the equation of stable states is not solved (the solver fails or does not converge), a constant-parameter model fails the evaluation (retcode 311), and a switching model, whose initialization averages the regimes’ transitions, keeps lyapunov_diffuse_factor with a warning.

a positive scalar \(\kappa\)

Harvey’s large-variance approximation: put \(\kappa\) on all states, optionally discarding a presample (kf_presample) while the diffuseness washes out.

'exact'

The exact Durbin–Koopman diffuse filter: the diffuse directions are resolved in a short, exact diffuse phase and the likelihood is \(\kappa\)-free.

1.15.1. Regime switching

With regimes \(r=1,\dots,h\), transitions \(T_r\), shock loadings \(R_r\) and initial regime probabilities \(\pi_r\), the stationary coordinates of the previous period start with a reference covariance \(V\) that solves

\[V = \bar T V \bar T' + \bar\Omega, \qquad \bar T = \sum_r \pi_r T_r, \qquad \bar\Omega = \sum_r \pi_r R_r R_r'.\]

The first prediction in regime \(r\) uses that regime’s transition and loadings: its covariance is \(T_r V T_r' + R_r R_r'\). Exact initialization does the same on its stationary coordinates. With one regime \(V\) is the unconditional stationary covariance.

Note

For switching models, initialization uses a reference covariance from the probability-weighted transition and regime innovation covariances, followed by a regime-specific first prediction. This approximation is rotation-invariant; it is not the exact regime-conditional stationary covariance of the switching process.

The state/shock cross-covariance uses the matching regime’s loadings on the coordinates whose finite initial covariance contains their shock variance. For Harvey initialization, it uses \(R_r\) when \(\kappa\) is at least the largest eigenvalue of \(R_r'R_r\), and zero otherwise, keeping the augmented state/shock covariance positive semidefinite.

The likelihood, the filtered and smoothed variables and the regime probabilities are invariant to regime-specific orthogonal rotations of the shocks. Each regime’s shock covariance \(R_r R_r'\) stays unchanged and its state/shock cross-covariance rotates with the shocks.

1.15.2. Why prefer exact

The big-\(\kappa\) likelihood carries a spurious offset \(-\tfrac{q}{2}\log(2\pi\kappa)\) (with \(q\) the number of diffuse directions) that depends on \(\kappa\). It therefore contaminates the log-likelihood, the marginal data density, and any model comparison. Exact initialization removes it: there is no \(\kappa\) to choose, no presample to discard, and no conditioning penalty (big-\(\kappa\) also loses accuracy as \(\kappa\) grows and the covariance becomes ill-conditioned).

1.15.3. Usage

m = solve(dsge_model('mymodel.rs'));
m = set(m, 'data', db);
[~, loglik] = filter(m, 'kf_init_variance', 'exact');   % 2nd output is the loglik

filter returns [filtration, LogLik, Incr, retcode, obj]. Use kf_presample = 0 if you want the diffuse-period term included in the likelihood (a presample discards it).

1.15.4. Scope

Exact diffuse initialization is available in the interacting-multiple-model (imm, the default) engine and in the GPB-family regime-switching filters immn, kim_nelson and gpbn. It works for both constant-parameter and regime-switching models – a single-regime model is routed to imm by default. To use one of the GPB filters, pin it with kf_user_algo (for example filter(m, 'kf_init_variance', 'exact', 'kf_user_algo', @rise.engine.filtering.kim_nelson)); all four give the same diffuse loglik. If a filter that does not implement exact is pinned (e.g. imm_o or the constrained cell filter) while a diffuse direction reaches the observables, RISE warns: that filter starts from the finite part \(P_*\) alone. myConstantParamFilter and myKnownRegimesFilter stop with an error instead (they used to return the likelihood of a known initial state with success status).

Exact diffuse is valid for the regular case: a diffuse block that is the same across regimes (a shared trend or unit root, with switching confined to transitory dynamics, loadings, or shock variances). A guard keeps it there: if the nonstationary invariant subspace differs across regimes (a regime-dependent diffuse block), RISE warns and falls back to big-\(\kappa\) rather than return a silently-wrong likelihood. The regime-dependent case is the home of the augmented (de Jong) formulation, which is derived but not yet implemented.

The diffuse update takes the observables one at a time. Correlated measurement errors (a non-diagonal \(H\)) are decorrelated first, \(H = L D L'\) with \(L\) unit lower triangular: the observations \(L^{-1} y\) have independent errors and the same likelihood. An observation that carries no diffuse variance and no finite variance either (a noiseless observation the previous ones already explain) stops the filter with retcode 305, as a singular forecast-error covariance does outside the diffuse period.

Smoothing over the diffuse period: kim_nelson runs a Durbin–Koopman dual-accumulator backward recursion across the diffuse span, one observation at a time, the forward steps reversed. A period whose diffuse variance reaches only some of the observables keeps the information of the others (a stationary state observed in that period is smoothed to its observation). The shared regime-switching smoother of imm, immn and gpbn uses the published information/disturbance recursion with finite and diffuse backward accumulators. It does not substitute a large finite covariance for the diffuse component. The single-regime local-linear-trend controls are checked against the classical exact diffuse smoother, including small innovation scales. Switching histories remain approximated: probability-averaged smoothed levels and growth rates can be inconsistent after a switch. Exact-history posterior calculations are independent references and are not claimed to coincide with this approximation.

The diffuse subspace is the nonstationary invariant subspace of the state transition, computed from an ordered real Schur decomposition, so it is correct not only for a random walk but for multiple and defective unit roots – e.g. a local linear trend, whose transition [1 1; 0 1] is a Jordan block with a two-dimensional diffuse subspace but a single eigenvector.

The worked example Estimation/diffuse_initialization/howto.m in the tutorials prints the \(\kappa\)-offset and demonstrates its removal (ll_bigk + \tfrac{q}{2}\log\kappa \to ll_{exact} at rate \(O(1/\kappa)\)).

Note

Reference: Durbin, J. and Koopman, S. J. (2012), Time Series Analysis by State Space Methods, 2nd ed., ch. 5 (the exact initial Kalman filter).